我想以管理员身份运行此cmd
命令
sleep -m 500
所以我使用了这个命令。
powershell -Command "Start-Process sleep.exe -m 500 -Verb runas"
出现错误:
Start-Process : A parameter cannot be found that matches parameter name 'm'. At line:1 char:47 + Start-Process C:\Windows\System32\sleep.exe -m <<<< 500 -Verb runas + CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand
然后,我使用了这个命令
powershell -Command "Start-Process 'sleep.exe -m 500' -Verb runas"
出现错误:
Start-Process : This command cannot be executed due to the error: The system cannot find the file specified. At line:1 char:14 + Start-Process <<<< 'C:\Windows\System32\sleep.exe -m 500' -Verb runas + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
然后,我用了这个:
powershell -Command "Start-Process sleep.exe /m 500 -Verb runas"
出现错误:
Start-Process : A positional parameter cannot be found that accepts argument '500'. At line:1 char:14 + Start-Process <<<< C:\Windows\System32\sleep.exe /m 500 -Verb runas + CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand
有人能告诉我正确的命令吗?我希望它是批量版本。
答案 0 :(得分:0)
I figured it out.
The command is this:
powershell -Command "Start-Process -FilePath C:\Windows\System32\sleep.exe -ArgumentList -m,500"