[英]How do I use robocopy to run a powershell elevated copy with spaces in the directory names?
If you find a better question that encompasses my situation, please let me know.如果您发现更适合我的情况的问题,请告诉我。 I haven't found my case yet.我的case还没找到
I tried running an elevated powershell command with:我尝试使用以下命令运行提升的 powershell 命令:
powershell -command "somecommand -Verb runas"
as作为
powershell -command "robocopy \\hostess\blab\foo 'C:\Program Files\foo ' /s /e /r:0 /z -Verb runas"
The robocopy part works by itself but then adding powershell causes: robocopy 部分自行工作,但随后添加了 powershell 原因:
ERROR : Invalid Parameter #7 : "-Verb"
The verb is a parameter of powershell executable and not part of the command parameter动词是 powershell 可执行文件的参数,而不是命令参数的一部分
powershell -command "robocopy \\hostess\blab\foo 'C:\Program Files\foo ' /s /e /r:0 /z" -Verb runas
see also https://ss64.com/ps/syntax-elevate.html另见https://ss64.com/ps/syntax-elevate.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.