运行命令以管理员身份与规格

条件,我想管理员身份运行" title="以管理员身份运行">以管理员身份运行命令以管理员身份与规格

sleep -m 500 

所以我用这个命令来运行这个命令cmd

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

谁能告诉我正确的命令呢?我希望它是批处理版本。

回答:

我想通了。

的命令是这样的:

powershell -Command "Start-Process -FilePath C:\Windows\System32\sleep.exe -ArgumentList -m,500" 

以上是 运行命令以管理员身份与规格 的全部内容, 来源链接: utcz.com/qa/260882.html

回到顶部