
I haven't tested these changes I'm sure the concepts of the fixes are correct, but I may have introduced a bug, so test carefully. The original would prevent you from replacing "&" with "_and_".
#BATCH FILE RENAME XP CODE#
I simply added a message indicating the failed file/dir that only fires upon failure.ģ) I improved the argument parsing code at the top to support special characters like & or ^. The REN command gives an error message, but doesn't tell you what file/dir failed. I thaught it would be quite simple if I could change it with a DOS command or Batch file however this has proved to be a bit more difficult than I would. I needed to create a few more vars to compensate.Ģ) The rename can fail if the new name already exists (duplicate) or if the name is empty after the substitution. I postpone enabling delayed expansion and toggle it on and off within the loop. That character is not seen often, but you may be sorry if you happen to run into one and use the original code The problem is the expansion of the FOR variable when delayed expansion is enabled. System requirements: Microsoft Windows XP / Vista / 7 / 8 / 8.1 / 10. Vovsoft Rename Multiple Files is a tiny tool that is designed with ease of use in mind. I've made a few improvements, some more important than others:ġ) The original will corrupt any renamed file/dir that contains ! in the name. Rapid File Renamer will help you to achieve file renaming in just a couple of. REM ECHO !CD!,%%G,%%H > !UNTMP!RENAMELOG.TXT

Paste -d, !SUBDIRLISTORIG! !SUBDIRLISTNEW! > !SUBDIRLISTCOMB!įOR /F "tokens=1,2 delims=," %%G IN (!SUBDIRLISTCOMB!) DO ( SET SUBDIRLISTCOMB=!UNTMP!SUBDIRLISTCOMB.TXTĭIR /ON /B | sed "s/ /_/g" > !SUBDIRLISTNEW! SET SUBDIRLISTNEW=!UNTMP!SUBDIRLISTNEW.TXT SET SUBDIRLISTORIG=!UNTMP!SUBDIRLISTORIG.TXT SPACES SUBSTITUTED FOR UNDERSCORES.COMPLETE! 5 Answers Sorted by: 16 You could use for to loop through each directory and rename it like so: for /D f in (C:\path\to\Workspace\) do rename 'f' 'nxfmyname' I tested this on Windows 7, but it should work at least as far back as with Windows XP. SETLOCAL ENABLEDELAYEDEXPANSION::REMOVE SPACES FROM FILES NAMESĮCHO Filenames containing Spaces were found - Removing spaces.įOR /R %1 %%G IN (.) DO ECHO !CD! & CALL :spaceRemove "%%G"ĮCHO.
#BATCH FILE RENAME XP HOW TO#
The script already contains setting UAC off, disabling firewall and creating a folder and sharing it (which I would also know how to set it to give full control to the. Use REN Command Ren is for rename ren ( where the file is located ) ( the new name ) example ren C:\Users\&username\Desktop\aaa.txt bbb.txt it will change aaa.txt to bbb.txt Your code will be : ren (file located)AAAa001.jpg ren (file located)BBBa002.jpg ren (file located)CCCa003.

REM %1 is top level of dir heirachy to be checked e.g. If I have to go find it myself it's easier to just change via device properties since the batch file would contain other things and the script above would just get in the way.
