gpt4 book ai didi

powershell - 从终端进行Visual Studio Code PowerShell代码调试

转载 作者:行者123 更新时间:2023-12-03 00:07:45 24 4
gpt4 key购买 nike

我在代码窗口中打开了PowerShell脚本。我正在从终端启动相同的脚本,并希望它在 Debug模式下运行。这意味着:脚本将在断点处停止。

描述的行为将类似于PowerShell ISE。
但是,它将运行整个脚本,而不会在断点处停止。

从终端启动时,有没有办法实现脚本调试?

最佳答案

执行PowerShell控制台时,可以在下面使用此命令在脚本中给定代码行处设置断点,然后指定脚本。当脚本运行时,它将在您请求的给定点中断。

Set-PSBreakpoint -Line 9  -Script C:\temp\test_script.ps1

关于powershell - 从终端进行Visual Studio Code PowerShell代码调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57244922/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com