Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Quoting

Oct
356
2
Hello — I am not sure if I missed something in the help for quoting but this is what I found.

I was scanning old hard drives for jpg’s that I might have missed along the way moving to new system and came up with a list of files. When I looked at the list, each file was annotated with its full path, and for the most part, many of the files contained blanks in the name. At first I simply just quoted (“) all the files, but I found that I missed some of the files in the list — as it turns out some of the files also contained a the trigger % so there were files like

“foo %bar.jpg”

were not found via the copy command, so checking with the help, what I need to use was the back quote (`) so then when with

`foo %bar.jpg` which did not behave as the help seemed to indicate. From what I can tell, when the command

copy “foo %bar.jpg” newfile.jpg

executed, the back quotes were remove and the copy command was looking for the files

foo and %bar

After trying different variations what seemed to work was

copy `“foo %bar.jpg”` newfile.jpg

With this form, it seems that the back quote stops %bar to be evaluated and the quotes protect the blank in the file name — is this the best way to do this? Thanks
 
If you're doing it manually, you could used "foo %%bar.jpg" with no back quotes to give a literal %-sign, or use "SETDOS /X-3" to simply disable (all) variable expansion.

If the process is automated, and the file names are in a variable ( for example, do file in @filelist.txt (copy "%file" ...) you could use SETDOS /X-4. That turns off nested variable expansion (so %file wold be expanded, but %s inside %file would not).
 
Back
Top