Powershell start notepad.exe and a command windows starts and disappears

Question:

I have a script to start another ps1 script as aspecific user that does a simple dir on a directory and it works, when it runs a separate cmd window appears with the directory contents.

My goal is to start an application as a specific user. So first I wanted to test with notepad.exe So I changed the last line to:

All I get is a command window that quickly disappears, can’t tell if there is an error etc. I also tried calling a ps1 script that invoked notepad and got the same result, even though on its own the the new script invoked notepad just fine.

Can someone explain where I am going wrong, Thanks

Answer:

If you’re wanting to start an application, wouldn’t you just use that as the target of Start-Process instead of opening another PowerShell window to do it?

Source:

Powershell start notepad.exe and a command windows starts and disappears by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply