MCS
1
Sorry first
english is not my nativ language, and i am an normal user of Powershell.
so my question i want start an Powershell script as administrator from cmd.
i using follow command in my batch-file:
PowerShell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy Bypass -File "test.ps1"' -Verb RunAs}"
Olny powershell Windows flashing but nothing happend
can someone help me to fiy my problem ?
@MCS welcome to PowerShell.org community.
Its probably executing the test script and exiting. What are you doing in the test.ps1
Olaf
3
The account running the CMD has to be an administrator to be able to elevate the PowerShell process. You know that, don’t you? 
MCS
4
Its olny a test , that the ps1-script make a break and wait press button
Script Test.ps1
write-Host “pause”
Pause
And yes is have to start as administrator
Olaf
5
Pause
is an internal command from CMD. You cannot use it in PowerShell without actually calling CMD. 
You can use somthing like this instead:
Write-Host -NoNewLine 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
it should work actually, its a function in PowerShell which calls Read-host
internally. Calling Read-Host
alone should also work.
c:\> ${function:pause}
1 Like
MCS
7
I change like you say, but nothing change
ist olny flashing the powershell window 
I think there is any problem with the execution policy. but i cnt find the failure
Olaf
8
… learned something new again today … thanks.

1 Like
Olaf
9
You could try to add the parameter -NoExit
to the command line …