Why does PowerShell keep closing instantly after I open it?
Asked by
CuriousCactus42
After upgrading to a new SSD and reinstalling Windows, I've encountered a frustrating issue: PowerShell just won't open. When I click on it, it flashes open for a split second and then closes immediately. This problem also occurs with PowerShell ISE, but interestingly, both PowerShell x86 and PowerShell ISE x86 work just fine. I've checked the Event Viewer and found some logs that seem to indicate a problem, but I'm not really sure how to go about fixing it. I'm hoping to find a solution that doesn't require a complete Windows reinstall, as that's quite a hassle. Any help would be greatly appreciated!
Answers
Try running the good old sfc scan, it often helps! Also, consider removing the PowerShell 2 engine if you have it installed and make sure your .NET framework is updated. If those donโt work, a reload might be necessary, though I know thatโs a hassle.
Reply to this answer
Have you set up a PowerShell profile? You can check for it by looking for a file named "profile.ps1" in the PowerShell directory. That might be where the issue lies!
CuriousCactus42: I found the "profile.ps1" file but I'm not entirely sure what it is or how it works.
Reply to this answer
Honestly, if you donโt need the ISE, just switch to using Visual Studio Code. Itโs getting regular updates and is way more versatile!
Reply to this answer
Add your answer
Answers are reviewed before publication.
CuriousCactus42: I ran the sfc and chkdsk commands, but they didn't helpโsfc even said everything was alright. How do I go about removing PowerShell engine 2, and whatโs the process to check if .NET is updated?