A
A
Alexander Semenenko2019-05-06 10:16:44
Windows
Alexander Semenenko, 2019-05-06 10:16:44

How to rename windows files and subdirectories, change "!" to underscore using bat script?

There is a directory in which there are subdirectories and files in the name of which there is an exclamation mark. You need to somehow recursively go over and change the "!" on the "_". How to automate this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2019-05-06
@semenenko88

Check:

for %%g in (*.*) do call :s_subroutine "%%~nxg" "%%g"
goto :eof
:s_subroutine
set _sss=%1
set _ddd=%_sss:!=_%
ren %2 %_ddd%
exit /b 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question