简体   繁体   English

使用PowerGUI调试PowerShell

[英]Debug PowerShell using PowerGUI

I use PowerGUI to edit my script. 我使用PowerGUI来编辑我的脚本。 In Visual Studio, I can add command line argument from project properties. 在Visual Studio中,我可以从项目属性中添加命令行参数。 However, I cannot find a way to set parameters to the UI to debug my codes with specified $args. 但是,我找不到一种方法来设置UI的参数,以使用指定的$ args调试我的代码。

For example, I set one debug point in PowerGUI, first line of my start code. 例如,我在PowerGUI中设置了一个调试点,即启动代码的第一行。 Then I try to start my script from UI's panel "PowerShell Console" with some parameters(which is one way I guess I can pass my parameters to run my scripts). 然后我尝试从UI的面板“PowerShell控制台”启动我的脚本和一些参数(这是我猜我可以通过我的参数来运行我的脚本的一种方式)。 The script runs without stopping in my debug points. 该脚本在我的调试点中不停止运行。 Any way available in PowerGUI? PowerGUI中有哪些方法?

OK. 好。 I think I find a way to pass parameters to my script and debug in PowerGUI. 我想我找到了一种方法将参数传递给我的脚本并在PowerGUI中进行调试。 It is not visible from menu items. 从菜单项中看不到它。 However, if you click on customize toolbar, you will find out one from "ScriptsParameterCommand" command. 但是,如果单击自定义工具栏,您将从“ScriptsParameterCommand”命令中找到一个。 You just drag it to the toolbar. 您只需将其拖动到工具栏即可。

Then type in any parameters in the "input script parameters here" toolbar icon, a text box. 然后在“输入脚本参数在这里”工具栏图标,文本框中键入任何参数。 Type in parameters. 输入参数。 Finally press enter key. 最后按回车键。 I run my script in debug mode and it does stop at the debug points! 我在调试模式下运行我的脚本,它在调试点停止!

Actually, I got this help from this article: Features of PowerGUI Script Editor 实际上,我从这篇文章得到了这个帮助: PowerGUI脚本编辑器的功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM