Windows Batch File Rename to Replace %20 Characters with _
I have a folder with a lot of files that I need to rename. The
original format for example is
ABC%20DEF%20GHI%20JKL.xyz. What I
need to do is to replace each
_. So essentially I'm
parsing out the %20 characters from the file names and then replacing
those with an underscore
Ideally I'd like to be able to complete this with a script rather than
Warning: If you are asking where to start to learn how to do this with batch and rename command, then this question will be tagged as off-topic more than likely (see Techie007 response in comments below my answer).
Below is a batch script example that replaces all
%20 characters from file names and replaces them all with underbar\underscore
_ characters. So you can look over it and see if that gives you some starting points as well. This will complete the task you're tring to accomplish otherwise, per your inquiry, and either of the two ways it can be interpreted without further clarification.
I'll post some resources for learning below the batch script though, and that'll be additional learning resources for starting points too.
Batch script example to parse
%20 and replace with and underbar
_ with batch for files in a particular directory.
FOR /F "USEBACKQ DELIMS=" %%N IN (
`DIR /A-D /B "%rendir%"`
) DO (
IF NOT "!Var!"=="!Orig!" (
IF NOT EXIST "%%~DPN!Var!" (
REN "%rendir%\!Orig!" "!Var!"
) ELSE (
Further Reading and Resources