Repository navigation
Open
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeOS-WindowsWG-Interactive-Consolethe console experiencethe console experienceWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group
Milestone
Description
Steps to reproduce
In Windows Run dialog type this:
PowerShell.exe -WindowStyle Hidden -Command ping www.microsoft.com
Expected behavior
There should be no window, right now you can't start powershell without window flashing, making it rather useless e.g. for scheduled tasks.
Note I think this is intended behavior, but it's confusing and new option is probably required. If you search how to run a powershell in scheduled task, the go-to workaround is to do a vbs script of all things! Such as:
Dim shell,command
command = "powershell.exe -nologo -File D:\myscript.ps1"
Set shell = CreateObject("WScript.Shell")
shell.Run command,0
This is not a good thing, powershell needs this feature in the shell itself, scheduled tasks are important feature and having a window flash on scheduled task is a really bad experience.
Actual behavior
It flashes the powershell window briefly.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Reacted by Willem D'Haese, seanlis, ouroborus, Fabio Rocha, Raymond Piller, Germs2004, workingmachine, TrueXakeP, Lewis Roberts, FrozenSoda and 157 more
Reacted by Benyamin Limanto and Daniel Alejandro Tapia
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeOS-WindowsWG-Interactive-Consolethe console experiencethe console experienceWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group
Activity
BrucePay commentedon Jan 25, 2017
powershell.exe is a console application. The console window is automatically created by the OS when the process starts. The powershell.exe code that processes -WindowStyle Hidden is therefore executed after the console window is opened hence the flash. To fix this, we would need the equivalent of wscript i.e. a win32 host application instead of a console host application.
SteveL-MSFT commentedon Feb 2, 2017
Given there's no code change we can do in powershell.exe to address this, I've changed this issue to a feature request to have a wscript-like host to support this type of scenario
rednoah commentedon Jun 26, 2017
You could have a
powershellw.exewhich would be a GUI application that doesn't show a console window. Same as whatjavaw.exeandpythonw.exedo.Jackbennett commentedon Feb 16, 2018
Can
pwsh.exeget support for this or get pwshw.exe as suggested above? With this pwsh exe being new it seems like a great time to change the behaviour of-windowstyle hidden. Nobody has ever usedhiddenand thought "yep that's what I wanted, flash some screen for a second".It makes sense that powershell.exe can't be changed after all this time and its legacy.
SteveL-MSFT commentedon Feb 21, 2018
I would support a community contribution to add
pwshw.exegtalton commentedon Feb 21, 2018
Agree .. this would be consistant with other language executables and solve me having to currently wrap my powershell scripts in vbs scripts.
iSazonov commentedon Feb 21, 2018
Technically we could do like https://github.com/AvaloniaUI/Avalonia/wiki/Hide-console-window-for-self-contained-.NET-Core-application
But I wonder - if PowerShell Core is portable what is expected behavior on Unix? Can we be unified on all platforms?
Related discussion https://github.com/dotnet/cli/issues/296 It also mentions that we could use GUI subsystem.
Maybe Michael Klement (@mklement0) have any thoughts?
SteveL-MSFT commentedon Feb 21, 2018
Ilya (@iSazonov)
-WindowStyleisn't supported on non-Windows136 remaining items
theJasonHelmick commentedon Mar 19, 2025
The WG-Interactive is re-reviewing this and will discuss with Terminal and Console.
esdnm commentedon Aug 7, 2025
I tried this, on one computer it worked, but on another it didn't run the script, results showed "The parameter is incorrect"
esdnm commentedon Aug 10, 2025
While running in full screen mode e.g. PowerPoint presentation, if the scheduled task runs, then the Taskbar becomes and remains visible during the whole duration of script run time. (And the usual flash at the start)
esdnm commentedon Aug 26, 2025
This worked! Thank you.
crazylegs1277-web commentedon Sep 11, 2025
2017 - crickets
2018 - crickets
2019 - crickets
2020 - crickets
2021 - crickets
2022 - crickets
2023 - crickets
2024 - crickets
March 16 2025 - ericohlin (@ericohlin): Hey guys since Microsoft isnt doing anything about this, here's another way
March 16 2025 - Dustin L. Howett (@DHowett): Um wait, your not supposed to use that its unreliable. PowerShell team, please stop them!!!!!
March 19 2025 - Jason Helmick (@theJasonHelmick): We're going to look into
LMAO! Thanks for this comedy and conhost.exe --headless ericohlin (@ericohlin). I guess I'll be using this like others until the PoSh team can come through or Dustin L. Howett (@DHowett) can come up with a better explanation than "I said so, I'm the owner"
“The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.”
― George Bernard Shaw
SeidChr commentedon Sep 11, 2025
crazylegs1277-web i feel left out now 🫣
#3028 (comment)
AntifaUnity commentedon Nov 20, 2025
This worked. Absolutely legendary work Sir.
I did have to add '-ExecutionPolicy Bypass'.
oldium commentedon Nov 20, 2025
Well, this is getting even more ridiculous. This is how I used NirCmd, originally installed via winget, to run windowless powershell:
But now the NirCmd package was removed from WinGet package index and they are rejecting to include it back. Seriously, Microsoft? You are removing the ways we are running the tools without making it working in the first place.
Update: switched from
wingettoscoopto installnircmd. 🤷Update 2: welcome another happy user of
conhost.exe😁adipiciu commentedon Mar 12, 2026
There is another workaround using a .js wrapper file. This way you can replace the vbscript silent wrapper solution which is deprecated.
Just replace your .vbs with the above .js file. The command to run powershell silently will be the same:
wscript.exe SilentWrapper.jsThe script can be modified to accept the powershell script file as an argument if needed.
This solution is a fast in-place upgrade to vbscript wrapper, if you don't want to use a compiled C# exe wrapper or the conhost.exe hack.
TheBestPessimist commentedon Mar 12, 2026
Come on microsoft. Use that copilot that you forcefully shove down all our throats to actually deliver a useful feature requested for 10 years very very soon.
Fix -WindowStyle Hidden console window flash
alexandj42 commentedon Apr 8, 2026
Wow. I was not expecting to run into what I thought was a small issue in Powershell behavior, and find that it is something that has been ongoing for over 9 years now. I will be looking into the vbscript or conhost workarounds, but it sure would be nice to get some attention from MS on this.
luciusbono commentedon Apr 8, 2026
Good luck everyone. I’ve moved to Linux and have never been happier.
v0.9.1 hot-fix: hidden-console launcher (kb-mcp-svc.exe) for Task Sch…