powershell - launching local apps fast
-
12-09-2019 - |
Question
I am building a kiosk type config script on low-spec hardware.
At the end of the script, it runs the various apps for the user to interact with. I currently use a plain Invoke-Command "path\to\app.exe
". I want to get the interface up and running as quickly as possible. I want to launch the apps asynchronous.
I know there is start-job, and the -asJob
flag in Invoke-Command
, but they don't seem to work with launching visual apps. Is there a way to do this?
Solution
Windows subsystem (visual) EXEs start asynchronously by default. And you don't need Invoke-Command to invoke an exe. If you exeute notepad.exe like so:
PS> Notepad
PS>
Note that the PowerShell prompt returns immediately while notepad is still running. The same applies in a script.