Reputation: 337
I have a batch file question
Set "filename=C:\Documents\Example.doc"
I have a string %FILENAME% and I want to replace the C:\ with C::\, without just redefining it, can anyone help?
Upvotes: 0
Views: 3039
Reputation: 49300
I'm not sure what you want to achieve here, and your variant of putting all of the set command in quotes is awkward, albeit valid, but anyway:
SET filename=%filename:C:\=C::\%
Or you just use the %filename:C:\=C::\%
expression in places where you want the other value, without actually changing the content of the Filename
variable.
For more details see (the output of) SET /?
.
Upvotes: 1