I’m trying to set up an integrated terminal profile in VS Code (v 1.90.2) to start up PowerShell with a couple arguments. Here is the block I’m using in my settings.json:
"powershell": {
"path": "${env:WINDIR}\System32\WindowsPowerShell\v1.0\powershell.exe",
"args": [
"-NoExit",
"-ExecutionPolicy ByPass"
],
"icon": "terminal-powershell"
}
However, when I try to start a terminal, it gives me this error:
-ExecutionPolicy : The term '-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -ExecutionPolicy ByPass
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (-ExecutionPolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I think the problem is that it’s passing the arguments to the PowerShell executable with single quotes. If I mouse over the terminal name on the right side, I can see in the pop-up it says
Command line: C:WINDOWSSystem32WindowsPowerShellv1.0powershell.exe '-NoExit' '-ExecutionPolicy ByPass'
If I try to run that exact line just hitting Windows+R to get the command prompt and pasting it in, it fails to start. If I remove the single quotes, it starts up fine.
Is there a way to stop VS Code from encasing those arguments in single quotes when it is instantiating the terminal?