Bruno_BNF
Bruno_BNF

Reputation: 51

Python in Visual Studio Code without PowerShell

So I need to use Python for my work. Unfortunately, since recent hacks, the companies security policies are very strict and there is no way I'm getting admin rights. I managed to persuade our IT to install Python, Visual Studio Code, and the Python extension for it on my computer.

If I try to run python commands in the Python interpreter it works. But when I try to run a Python script in Visual Studio Code it hast to run Power Shell which is also blocked for security reasons. I get the following error:

The terminal process command 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' failed to launch (exit code: {2})

Is there some way around this? To use Python in Visual Studio Code despite all of the security restrictions?

I tried asking our IT department but they have no idea how to help me...

Thank you in advance.

Upvotes: 1

Views: 2178

Answers (2)

mojtaba shirvani
mojtaba shirvani

Reputation: 31

I'm used below code in setting file and it works.

"terminal.integrated.defaultProfile.windows": "Command Prompt"

Upvotes: 2

The Fool
The Fool

Reputation: 20467

You can change the VS Code settings and tell it to not use PowerShell as shell in the integrated terminal.

For example, I have put Windows Terminal in there, but you can also use CMD or any other shell such a git bash as long as it's available in your system.

Press ctrl+shift+p and type/select Open Settings (JSON). Then add some of the following to this configuration file, and save.

For Windows Terminal:

"terminal.external.windowsExec": "C:\\Users\\<your-username>\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"

For CMD:

"terminal.external.windowsExec": "C:\\Windows\\system32\\cmd.exe"

Upvotes: 2

Related Questions