1

I installed visual studio code & downloaded python extension, When trying to execute code, I get an error that:

The terminal process failed to launch: A native exception occurred during launch 
   (File not found: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)

I am not the admin of this laptop as this is office laptop & don't have access to powershell nor will i get the access due to policy. Please suggest what I can do as a remedial measure — I have used only IDLE before for python. How to run code?

martineau
  • 119,623
  • 25
  • 170
  • 301
Alucard_og
  • 11
  • 1
  • It looks like your question may have a solution here: https://stackoverflow.com/questions/63202834/visual-studio-vs-code-code-terminal-is-failed-to-launch/63704415#63704415 – Anders Elmgren Jun 21 '21 at 17:57
  • 1
    Does this answer your question? [Visual Studio (VS-code) code terminal is failed to launch](https://stackoverflow.com/questions/63202834/visual-studio-vs-code-code-terminal-is-failed-to-launch) – Anders Elmgren Jun 21 '21 at 17:58

3 Answers3

0

You can change your VScode Terminal default profile

First select default profile

Select default profile

enter image description here

Then change from powershell to cmd

0

You can try to add this in the settings.json file:

  "terminal.integrated.defaultProfile.windows": "Command Prompt",
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
      "path": ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"]
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    }
  },

If your cmd was forbidden too, you can try to download the Code Runner Extension to execute the code.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
0

I had a problem with my Visual studio code, it didn't let me open the terminal it gave me an error "The terminal process failed to launch: A native exception occurred during launch(File not found: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)". I solved it by installing the Code Runner Extension.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jake Neumann
  • 372
  • 4
  • 13