Reputation: 335
How to replace words of a string in a for command? i try that but it doesn't work:
for %%i in (*.*) do move %%i "%%i:_OFF="
for %%i in (*.*) do move %%i "%:_OFF=%i"
for %%i in (*.*) do move %%i "%%i%:_OFF=%"
How to remove the _OFF
like %i:_OFF=%
.
input path/file1.ext_OFF
input path/file2.ext2_OFF
output path/file1.ext
output path/file2.ext2
Upvotes: 0
Views: 65
Reputation: 24410
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
Upvotes: 1