Possible Duplicate:
How can I mass rename files from the command line or using a 3rd party tool?

I have many PDFs of EBooks but some of them have underscores in their filenames so it becomes difficult to search the file by some words. Is there any program/script/software which replace all underscores with blank space in windows 7

  • Definitely a dupe. – EBGreen Jun 14 '11 at 15:44
  • Duplicate post (link). Here's your one-liner CLI answer - without installing additional software: for /f "tokens=* delims= " %i in ('dir /b "*.pdf"') do Set LIST=%i& set LIST | ren "%~fi" "%LIST:_= %" – Murdoch Ripper Oct 30 '13 at 17:10

It is really old software, but I use Lupas Rename 2000 to rename files in bulk. One of the rules you can use is "Replace text (_) with new text ( )".

It was last updated in 2005, but it is light, fast, and still works in Windows 7.

| improve this answer | |

From the command line:

dir *.pdf /b | mawk "/ / { q=sprintf('%c',34); new=$0; gsub(/ /, '_', new ); print     'ren 'q$0q' 'new }"

This command will not do anything, but output the command about to be executed. To execute it, you just add cmd at the end:

dir *.pdf  /b  |  mawk  "/ / { q=sprintf('%c',34); new=$0; gsub(/ /, '_', new ); print 'ren 'q$0q' 'new }" | cmd

You can download mawk.exe from http://www.klabaster.com/freeware.htm#mawk

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.