PowerShell command to exit script?

Soldato
Joined
28 Sep 2008
Posts
14,158
Location
Britain
At the moment, I have:

PHP:
Write-Host "Press Any Key To Exit"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

exit

My understanding was that when that line appears in the script, the user will be asked to press any key, and that when they do, the script will continue, in this case, "exit". Well, the "press any key to exit" appears, and when you press something, you do exit the script, but I actually want the PowerShell window to exit (ie, close)....

Is that possible?
 
Soldato
OP
Joined
28 Sep 2008
Posts
14,158
Location
Britain
no, the command appears at the end of a script, which is run during an unattended installation. The PowerShell output to the console window must be verified by an operator to ensure installation was correct (at this point, not really unattended). The script then says "Press any key to exit". pressing any key closes the powershell window as it is no longer required. :)
 
Back
Top Bottom