Powershell -- evaluation of double backslashes
Posted on 2014-10-30
$cp = "\\abcdfs1\$source \\axyzfs1\$dest /E /COPY:DAT /Z /R:5 /W:5 /v /purge /log:$logname1"
I am feeding the above line to a robocopy command, robocopy $cp
An echo of $cp prints as above, and expands the variables appropriately -- looks great.
When the command executes - backslashes are stripped from the second segment, such that:
\\axyzfs1\$dest becomes \axyzfs1\$dest
I've tried multiple backslashes and still end up with '1'. Of course, if I use single quotes, the variables don't expand. I've finagled all my ideas, assistance is definitely required and appreciated.
In a nutshell, I need the "\\" and I have variables to expand. I can only figure out how to do one or the other.