batch file to remove # from file names

August 18, 2011 at 08:03:07
Specs: Windows XP, E8400@3GHz/3.5GB
I have a large number of files that include the character "#" in the file name. This character (and others) causes trouble when I back up my hard drive, so I would like to remove it without changing each file name manually.

Is there a batch script I can run to rename my files, removing the "#"?

See More: batch file to remove # from file names

Report •

August 18, 2011 at 23:10:07
Test this, remove the REM command when you are happy that the script will do what you want.

@echo off

setlocal enabledelayedexpansion 

for /f "tokens=*" %%1 in ('dir /b *#*.*') do (
    set oldname=%%1
    set newname=!oldname:#=!
    echo !oldname! being renamed !newname!
    REM ren "!oldname!" "!newname!"

Please come back & tell us if your problem is resolved.

Report •
Related Solutions

Ask Question