Batch file to get rid of spaces in ROM filenames
Posted: Mon Dec 31, 2018 2:13 pm
If anyone has a crap ton of ROMs that will not scan due to spaces in the filenames, this might just help out. Make a batch file with the following text, and put the file in whatever ROM directory you want changed. This replaces spaces in the names with underscores, and will do this on every file in the directory. If you want to force it to only change, say .zip files, you can do this by replacing the *.* with *.zip, or whatever extension you wish:
Setlocal enabledelayedexpansion
Set "Pattern= "
Set "Replace=_"
For %%a in (*.*) Do (
Set "File=%%~a"
Ren "%%a" "!File:%Pattern%=%Replace%!"
)
Pause&Exit
Setlocal enabledelayedexpansion
Set "Pattern= "
Set "Replace=_"
For %%a in (*.*) Do (
Set "File=%%~a"
Ren "%%a" "!File:%Pattern%=%Replace%!"
)
Pause&Exit