2017-12-18 1 views
0

ich diesen cmd Befehl als AdministratorLauf-Befehle als Administrator mit Bedingungen mit Spezifikationen

sleep -m 500 

Also ich diesen Befehl ausführen wollte.

powershell -Command "Start-Process sleep.exe -m 500 -Verb runas" 

Fehler erschienen:

 
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 

Dann habe ich diesen Befehl

powershell -Command "Start-Process 'sleep.exe -m 500' -Verb runas" 

Fehler erschienen:

 
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 

Dann habe ich dies:

powershell -Command "Start-Process sleep.exe /m 500 -Verb runas" 

Fehler erschienen:

 
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 

Kann mir jemand sagen, den richtigen Befehl für sie? Ich möchte, dass es sich um eine Batch-Version handelt.

+0

'Power Hilfe Start-process' – ACatInLove

+1

Powershell und Batch sind völlig verschiedene Sprachen – SomethingDark

+0

Ja, ich weiß, ich kann es einfach nicht herausfinden, wie kann ich' Schlaf laufen - M 500 als Administrator mit Powershell .. Ja, ich weiß, wie man es als Admin mit "-verb runas" ausführen, aber wie kann ich den Befehl ausführen, den ich ausführen möchte ('sleep -m 500')? – scriptmastere02

Antwort

0

Ich fand es heraus. dies ist

Der Befehl:

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

Danke, ACatInLove für mich zu sehen 'Powershell Hilfe Start-Prozess': P – scriptmastere02

+0

Wenn Sie für eine native PowerShell-Funktion suchen, verwenden Sie' Start-Sleep' –

+0

Nein, ich will es für jedes Programm :) – scriptmastere02

Verwandte Themen