Home » Questions » Computers [ Ask a new question ]

Batch environment variable expansion when variable ends with a backslash?

Batch environment variable expansion when variable ends with a backslash?

I just need to ask if this is expected behaviour, it sure surprised me.

Asked by: Guest | Views: 301
Total answers/comments: 1
Guest [Entry]

"From this article:

If either the source or destination
are a ""quoted long foldername"" do not
include a trailing backslash as this
will be treated as an escape
character, i.e. ""C:\some path\"" will
fail but ""C:\some path\\"" or ""C:\some
path"" will work.

This is a problem specific to robocopy. I would even go as far as to call it a bug.

You have no other solution but to add code to your batch file that will check and delete a backslash from the end of the source and destination."