Replacing/removing ! in a batch file (with answer)

Post any Bulk Rename Command support requirements here. Open to all registered users.

Replacing/removing ! in a batch file (with answer)

Postby 12characters » Wed Jun 27, 2018 9:38 pm

I needed to remove exclamations marks from file names. After reading an answer somewhere on this forum, it appears that exclamations (as well as ampersands &) need to be escaped with ^.

Unfortunately the batch processor grabs the caret, so the answer is to use 2 of them, like so:

Code: Select all
BRC32 /PATTERN:* /REPLACECI:^^!:CharlieXCX /EXECUTE


I hope this saves someone somewhere from frustration.
12characters
 
Posts: 1
Joined: Wed Jun 27, 2018 9:25 pm

Re: Replacing/removing ! in a batch file (with answer)

Postby bru » Thu Mar 07, 2019 8:35 pm

Exclamations should only need 'double-escaping' if delayed !variable! expansion is enabled.
In that case, cmd grabs the 1st-caret, so a 2nd is needed, but only for exclamations.
Thanks!
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm


Return to BRC Support