1.

Solve : Using "&" in batch path??

Answer»

Can someone help a noobie here...

I've got a batch file that does a simply file copy.. However the directory contains "&" which I'm not sure is valid in batch files.

there's also spaces.. however I have removed the spaces to tested it with the "&" and it still fails, checking the DOS box it says the path is invalid, although I know it's not.

Can someone help please You could try "escaping" the & CHARACTER by preceding it with a caret (^) character.

So in a batch you would have ^& instead of &.

This is the standard way of dealing with the special characters such as <>!%& etc which have special MEANING at the prompt and in batch files.

The & (ampersand) character is well known as a "poison character" for the effect it has on batch file execution, and its use is deprecated in file and folder names.





Thanks for the help.

One more quick QUESTION, the spaces in the path..

I've tried underscore that doesn't work, I've also tried a normal space, assume it's seeing that as the gap between the two paths though.

Any idea? Path and file names which contain one or more spaces need to be enclosed with quotes.

C:\Program Files\My Special Application Folder will fail

"C:\Program Files\My Special Application Folder" will not.



Discussion

No Comment Found