How can I terminate a terminal/PowerShell window from a .ps1 script? I would like it to work the way exit
in command line works, but when I put that in a PowerShell script it only terminates the script.
CodePudding user response:
Environment.Exit()
will terminate the whole process:
# replace 0 with a non-0 error code if you want to indicate some sort of failure
[Environment]::Exit(0)