-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"script" configuration in launch.json behavior no longer runs a cmdlet. #3556
Comments
Duplicate of #3537 and (fortunately) already resolved, the fix is available in the PowerShell Preview extension. Can you confirm it works for you? I'm about to roll it into stable today. |
So sorry... can you link me to instructions to install the preview of the extension? I'd love to test it. |
@KevinLeeBuchan In the VS Code marketplace, search for "PowerShell." Disable the "PowerShell" extension, reload, then install the "PowerShell Preview" extension (with the pretty colored icon) and reload. |
That fix is now in the just-updated stable extension! |
I have tested it on two different machines, across four different configurations that rely on the same capability and all were successful. Thank you. Closing bug report. |
Prerequisites
Summary
I have been using a launch.json configuration for a couple years to run my active script in a new, external PowerShell window. Recently, this has broken. It's obvious from the text in the console that the working folder is being stuck onto the front of the value in the "script" setting as though it assumes the value is a .ps1 file in the local folder instead of a cmdlet that's been working forever.
This is the configuration section:
{
"name": "Run in External PowerShell Window - v5",
"type": "PowerShell",
"request": "launch",
"script": "Start-Process",
"args": [
"-FilePath ($Env:SystemRoot + '\system32\WindowsPowerShell\v1.0\powershell.exe')",
"-Argumentlist '-NoExit -ExecutionPolicy Bypass -File "${file}"'"
],
"cwd": "${file}"
},
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Create a PowerShell script to do something simple such as running Get-Process.
Save it into a folder.
Open the folder in VS Code .
Create a launch.json configuration with these settings:
{
"version": "0.2.0",
"configurations": [
{
"name": "PowerShell: Launch Current File",
"type": "PowerShell",
"request": "launch",
"script": "${file}",
"cwd": "${file}"
},
{
"name": "Run in External PowerShell Window - v5",
"type": "PowerShell",
"request": "launch",
"script": "Start-Process",
"args": [
"-FilePath ($Env:SystemRoot + '\system32\WindowsPowerShell\v1.0\powershell.exe')",
"-Argumentlist '-NoExit -ExecutionPolicy Bypass -File "${file}"'"
],
"cwd": "${file}"
}
]
}
Go to the debugging panel and select the option for "Run in External PowerShell Window - v5".
Hit F5.
Look in the terminal window for the error.
Visuals
No response
Logs
I tried setting logging to Diagnostic and to Verbose, but no log folder was created beneath $HOME.vscode\extensions.ms-vscode.powershell-1.9.0. I suspect this may be because I'm trying to launch in an external window.
The text was updated successfully, but these errors were encountered: