Passing Arguments to vscode-powershell
See original GitHub issueSystem Details
- Operating system name and version:
- VS Code version:
- PowerShell extension version:
- Output from
$PSVersionTable
:
Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here
code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable
Issue Description
Another stupid question. How do I pass in arguments when running Powershell code in VS code Powershell editor?
Attached Logs
Follow the instructions in the README about capturing and sending logs.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Debug powershell in Visual studio code with parameters from ...
Show activity on this post. Then just open the "Run and Debug" sidebar pane on VSCode (the play button with the bug or...
Read more >Function parameters while debugging PowerShell in Visual ...
Adding parameter values to PowerShell debugging in Visual Studio Code is doable. This article explains how.
Read more >PowerShell editing with Visual Studio Code
The Microsoft PowerShell extension for Visual Studio Code (VS Code) provides rich language support and capabilities such as syntax completions, ...
Read more >Debugging PowerShell script in Visual Studio Code – Part 2
args is an array of arguments to pass to the script being debugged. However, it usually works best to put all the arguments...
Read more >Debugging PowerShell in VSCode with Josh Duffney - YouTube
Josh Duffney presents skills required to become proficient in debugging, allowing you to take that next step towards greatness.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have a look at:
https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/06/debugging-powershell-script-in-visual-studio-code-part-1/ https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/13/debugging-powershell-script-in-visual-studio-code-part-2/
Specifically part 2, section “Launch configuration settings / variables”.
You can also add a new Debug Configuration (open your .vscode/launch.json file and press the Add Config button) called “PowerShell: Launch Current File w/Args”. This configuration will prompt you for the arguments.
Does this look right?
I just want to pass a string “qa” as argument zero.
The top portion of my launch.json file
{ “version”: “0.2.0”, “configurations”: [ { “type”: “PowerShell”, “request”: “launch”, “name”: “PowerShell Launch Current File w/Args Prompt”, “script”: “${file}”, “args”: [“-myArg qa”], “cwd”: “${file}”
-Joe B.
From: Keith Hill [mailto:notifications@github.com] Sent: Tuesday, July 18, 2017 11:09 AM To: PowerShell/vscode-powershell vscode-powershell@noreply.github.com Cc: Bruns, Joe W. (TR Technology & Ops) joe.bruns@thomsonreuters.com; Author author@noreply.github.com Subject: Re: [PowerShell/vscode-powershell] Passing Arguments to vscode-powershell (#965)
Have a look at:
https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/06/debugging-powershell-script-in-visual-studio-code-part-1/https://urldefense.proofpoint.com/v2/url?u=https-3A__blogs.technet.microsoft.com_heyscriptingguy_2017_02_06_debugging-2Dpowershell-2Dscript-2Din-2Dvisual-2Dstudio-2Dcode-2Dpart-2D1_&d=DwMFaQ&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=EmXB1hdqAUsNr2oNinCjmF_WQrDx6UdLKFBtFym2pdM&m=ekZk3Dtyi3Dziv6pkoeoD9niLZ6jxUvMZ-vBAaaI1Nc&s=CqPS2mufuJJe90FBBL5jHDtLxaPOUGzUgB6sxoS789c&e= https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/13/debugging-powershell-script-in-visual-studio-code-part-2/https://urldefense.proofpoint.com/v2/url?u=https-3A__blogs.technet.microsoft.com_heyscriptingguy_2017_02_13_debugging-2Dpowershell-2Dscript-2Din-2Dvisual-2Dstudio-2Dcode-2Dpart-2D2_&d=DwMFaQ&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=EmXB1hdqAUsNr2oNinCjmF_WQrDx6UdLKFBtFym2pdM&m=ekZk3Dtyi3Dziv6pkoeoD9niLZ6jxUvMZ-vBAaaI1Nc&s=GUnYYPGLoE7OjIdCGi48wvz9sCJB9h-SPFST5ZBV-Gw&e=
Specifically part 2, section “Launch configuration settings / variables”. You can also add a new Debug Configuration (open your .vscode/launch.json file and press the Add Config button) called “PowerShell: Launch Current File w/Args”. This configuration will prompt you for the arguments.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_PowerShell_vscode-2Dpowershell_issues_965-23issuecomment-2D316113999&d=DwMFaQ&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=EmXB1hdqAUsNr2oNinCjmF_WQrDx6UdLKFBtFym2pdM&m=ekZk3Dtyi3Dziv6pkoeoD9niLZ6jxUvMZ-vBAaaI1Nc&s=0uRv6vL31teUuX3CoqBDmjdt_SFPHbx5fcCzzItHFAk&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AObZjCoOfvMyLLbenBTJPSNPD-5FfXHuuCks5sPNiPgaJpZM4Objpa&d=DwMFaQ&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=EmXB1hdqAUsNr2oNinCjmF_WQrDx6UdLKFBtFym2pdM&m=ekZk3Dtyi3Dziv6pkoeoD9niLZ6jxUvMZ-vBAaaI1Nc&s=JFp_NJY4bvEzeSYz6ZLTwZ78FbzvziK70VAc1-Rwy2Q&e=.