VS Code运行程序时出现“powershell.exe does not exist”错误请求技术协助
Fixing "powershell.exe does not exist" Error in VS Code
Hey there, let's work through this terminal startup issue step by step. Here are the most effective fixes to get your VS Code terminal running again:
1. Verify PowerShell's Actual Path
First, let's confirm if the path VS Code is targeting actually exists on your system:
- Open File Explorer and navigate to
C:\Windows\System32\WindowsPowerShell\v1.0\ - Look for
powershell.exein this folder:- If the file is missing: You may need to reinstall PowerShell. On Windows 10/11, you can grab it via the Microsoft Store, or enable it through Turn Windows features on or off (search this in the Start Menu, then check "Windows PowerShell" if it's unchecked).
- If the file exists: Move on to the next fix.
2. Update VS Code's Terminal Path Configuration
VS Code might be pointing to the wrong PowerShell path—this is common if you're using 32-bit VS Code on a 64-bit system. Here's how to adjust it:
- Open VS Code and press
Ctrl + ,to launch Settings. - In the search bar, type
terminal.integrated.shell.windows(note: for VS Code 1.60+, this setting is replaced by profiles—search forterminal.integrated.profiles.windowsinstead). - Replace the default path with the correct one:
- For 64-bit systems (most common):
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe - For 32-bit VS Code: Use
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe(32-bit apps access 64-bit system files via the SysWOW64 directory)
- For 64-bit systems (most common):
- Alternatively, open your
settings.jsonfile (click the "Open Settings (JSON)" icon in the top-right of the Settings panel) and add/update this line:"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" - Save the settings and restart VS Code.
3. Switch to Command Prompt as a Temporary Workaround
If you need to run code right away while troubleshooting PowerShell, you can set Command Prompt (cmd) as your default terminal:
- In VS Code Settings, search for
terminal.integrated.defaultProfile.windows - Select "Command Prompt" from the dropdown list.
- VS Code will now launch cmd instead of PowerShell, letting you execute your code without waiting for the PowerShell fix.
4. Check System Environment Variables
Sometimes the PowerShell path isn't added to your system's PATH variable, which can prevent VS Code from finding it:
- Right-click "This PC" → "Properties" → "Advanced system settings" → "Environment Variables"
- Under "System variables", locate the
Pathvariable and click "Edit" - Check if
C:\Windows\System32\WindowsPowerShell\v1.0\is in the list. If not, click "New" and add it. - Click "OK" to save changes, then restart your computer and VS Code.
内容的提问来源于stack exchange,提问作者JpN




