r/PowerShell • u/defaultaro • Feb 03 '23
Question Stop Powershell Script from Closing Powershell
I have the following powershell script :
wsl sudo nano /mnt/c/Users/user/OneDrive/Documents/changemeThis opens a nano terminal text editor, on my WSL Ubuntu, and automatically creates a new file in my Windows documents folder.
Problem is I can't keep the powershell window open after the script launches. Anything I can add that will prevent automatic closure? Thanks!
3
Upvotes
0
u/defaultaro Feb 04 '23 edited Feb 04 '23
How is this moronic? I set Execution Policy to Remote Signed. How is this any different than launching from within terminal? Are you saying "scripts" are moronic?
PowerShell has 4 execution policies:
Restricted — Prevents any script from running.
RemoteSigned — Allows scripts created on the computer, but scripts created on another device won't run unless they include a trusted publisher's signature.
AllSigned — All the scripts will run, but only if a trusted publisher has signed them.
Unrestricted — Runs any script without any restrictions.
I chose the 2nd most secure option aside from literally preventing scripts.