VSCode PowerShell调试器:如何向PowerShell进程传递命令行参数
VSCode中PowerShell扩展调试终端无法应用命令行参数配置
我在VSCode标准终端中,已经成功配置了向PowerShell可执行文件传递命令行参数,配置如下:
"terminal.integrated.profiles.windows": { "General": { "path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "args": [ "-noexit", "-command", "Get-ChildItem", ] } },
现在我想给调试时使用的「PowerShell扩展终端」实现同样的参数传递功能。根据VSCode相关文档,terminal.integrated.automationProfile.<platform> 配置项应该可以实现这个需求,于是我做了如下配置:
"terminal.integrated.automationProfile.windows": { "path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "args": [ "-noexit", "-command", "Get-ChildItem", ] },
但这个配置没有生效。需要说明的是,我要的是向PowerShell可执行文件本身传递参数(向脚本传参可以通过launch.json的"args": []实现),Get-ChildItem只是示例,实际需求是取消调试器默认使用的noprofile参数,以此来测试我的配置文件。
内容的提问来源于stack exchange,提问作者Ralf_Reddings
相关产品推荐
相关产品推荐

