r/PowerShell • u/JackNotOLantern • Feb 20 '26
Run powershell without terminal window
How to run ps1 script without the terminal window showing up at all?
Using -WindowStyle Hidden still shows the terminal for a moment. Minimising to tray is also not the solution i am looking for.
I saw there are external tools but they are a potential security risk.
The only way I found that works is using vbs and disabled the console window inside it. However, vbs has some other issue, and is deprecated by Microsoft currently, so i would rather find another way.
So, are there any other solutions?
Edit:
It seems that running ps1 by using conhost is the solution i needed.
conhost --headless powershell -File script.ps1 ...
View all comments
Show parent comment
3
u/JackNotOLantern Feb 20 '26
Yes, i wanted to avoid creating a custom exe. As far as i understand most of the external tools are basically c# applications compiled into exe. C# allow to disable the terminal.
I will try your solution, or learn this c# enough to write my own runner if i don't find anything else. Thanks