2014-10-30 13 views
0

for 명령에서 문자열의 단어를 바꾸는 방법은 무엇입니까? 나는 그것을 시도했지만 작동하지 않습니다 for 명령의 단어를 일괄 적으로 바꾸는 방법은 무엇입니까?

for %%i in (*.*) do move %%i "%%i:_OFF=" 
for %%i in (*.*) do move %%i "%:_OFF=%i" 
for %%i in (*.*) do move %%i "%%i%:_OFF=%" 

방법 %i:_OFF=%처럼 _OFF를 제거 할 수 있습니다.

입력 path/file1.ext_OFF

입력 path/file2.ext2_OFF

출력 path/file1.ext

출력 path/file2.ext2

답변

1
for %%i in (*.*) do call:InnerLoop %%i 
goto end 

:InnerLoop 
set x=%* 
::below code demos the result 
echo. 
echo.%x% 
echo.%x:_OFF=% 
::below code would execute it 
move "%x%" "%x:_OFF=%" 
goto :eof 

:end