By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!I want to replace filenames that contain ";" with "_". I can't even get plain DIR to find the files.
Code:for %fn in ("*;*") ren "%fn" "%@replace[;,_,%fn]" dir /a:-d /b /s "*;*"
Both do not work.
Suggestion for a future version: Allow the vertical bar | as an include-list separator, behaving just the same as the semicolon.
And what would we do with pipes? And a jillion batch files and aliases using pipes?
C:\>dir "*.bat|*.cmd|*.btm"
Volume in drive C is Hard Drive Serial number is 6218:b594
TCC: (Sys) The system cannot find the file specified.
"C:\*.bat|*.cmd|*.btm"
0 bytes in 0 files and 0 dirs
156,308,537,344 bytes free
C:\>
You already have that part implemented. A vertical bar between quotes has no special meaning.
Is that so? Why did my first attempt to create "a;b" fail?Not sure what you're getting at -- a semicolon between quotes has no special meaning either.
v:\> touch /c "a;b"
2017-05-17 20:28:38.034 V:\b
v:\> *dir /a /p /m /k /h /ne "a;b"
2017-05-17 20:28 0 b
And there seems to be a special meaning here also.
Code:v:\> *dir /a /p /m /k /h /ne "a;b" 2017-05-17 20:28 0 b
I didn't quite have that figured out. Using TOUCH /C "a;b;c", if any exist it'll touch (only) them; in none exist, it'll create only the last one specified.What's going on with TOUCH? Below, it created only "b".
Code:v:\> touch /c "a;b;c" 2017-05-17 21:52:14.842 V:\b
Difference being that the semicolon is a valid (if silly) filename character, and the vertical bar is not.Not sure what you're getting at -- a semicolon between quotes has no special meaning either.
I want to replace filenames that contain ";" with "_".
ren "::^(.*);(.*)$" "::\1_\2" /n