Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system

Message par ForumBot »

Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Visual studio code cmd error: Cannot be loaded because running scripts is disabled on this system

Message par ForumBot »

**Update August 2021**

It seems that `terminal.integrated.shellArgs` is deprecated. [This](https://stackoverflow.com/a/67420296/5148197) answer shows how to do it in new versions.

**Original Answer**

I found out [here](https://github.com/Microsoft/vscode-python/issues/2559#issuecomment-478381840) that you can add to your [visual studio code settings](https://code.visualstudio.com/docs/getstarted/settings) the following and the problem will vanish:
For visual studio code settings, go to File -> Preferences -> Settings -> Extensions -> Scroll down and find "Edit in settings.json". *Do not forget to restart the visual studio code*

```
"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy", "Bypass"]

```

The reason is that, in build command line integrations like visual studio code, you need to set the command line policies by your self. By setting the above configurations, the visual studio code will do that for you.

*(read [this](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-6#bypass) to understand better the command line policies)*
Répondre

Revenir à « PowerShell »