candera / shadowspawn

A Windows utility that mounts a shadow copy of the disk at a drive letter and then spawns an arbitrary command.
MIT License
184 stars 55 forks source link

ShadowSpawn fails when robocopy uses a /log argument that includes quotes #20

Open dbolton opened 7 years ago

dbolton commented 7 years ago

When I include a /LOG argument with quotes ShadowSpawn gives the following error message: Error: Command line contains mismatched quotes: C:\Users\username\Documents\Backup\ShadowSpawn-0.2.2-x64\ShadowSpawn.exe "C:\Users\username\Documents\Backup\Test folder" Q: robocopy Q: "F:\Backup (Test)" /E /COPYALL /FFT /Z /XJ /ETA /LOG:"C:\Users\username\Documents\Backup\log.txt"

In this particular example I can drop the quotes and it works (because there are no spaces in the path).

However, I would eventually like to create a log in a path that includes a space (and therefore requires quotes).

Elrick91 commented 6 years ago

+1, i have exactly the same problem ... how to fix it please ? Why ShadowSpawn is not able to handle quotes ?

alpauna commented 5 years ago

Did you try with ^" on robocopy paths? Like this: robocopy Q: ^"F:\Backup (Test)^" /E /COPYALL /FFT /Z /XJ /ETA /LOG:^"C:\Users\username\Documents\Backup\log.txt^"

Just a suggestion. I have not tried this yet, but I am thinking of using this for locked file I have to deal with. The ^ tells cmd not to interpret the quotes then instead it leaves them for the next layer to interpret the quotes; but, also removes the ^ so the next cmd layer does not see it. Here is where I got that little bit of knowledge. I used to use \" all the time. There is a better way with the ^. Anyway, I will be testing your issue next week and get back with findings.

dbolton commented 5 years ago

@alpauna Thanks for the suggestion. Unfortunately I still get the same error if I escape using the circumflex (^") or backslash (\") as with the escaped double quote (").

Note, the plain double quotes work for the source and destination paths, just not the log.

cseufert commented 5 years ago

I may be way off here, but have you tried doing "/LOG:C:\Users\username\Documents\Backup\log.txt"

wyattcroucher commented 5 years ago

@cseufert This worked for me!