Can you post all code in your script right now? A syntax error means the switches/etc. were not written properly.
Here is the code:
---------------------------------------------
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /s /b *_MG_*.JPG') do (
set fileorig=%%a
set filenew=!fileorig:_MG_=!
rename !fileorig! "!filenew!"
)
pause
---------------------------------------
I have these files in the directory.
_MG_3338.JPG
_MG_3339.JPG
_MG_3340.JPG
_MG_3341.JPG
------------------------------------------
Here is the error message:
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
Press any key to continue . . .
---------------------------------------------------
The code works just fine without the /s.
Thanks,
myshutterclicks