While introducing ps, Microsoft did not forget its consistent style of work and set up an IDE environment for everything. Microsoft did not forget to provide ps with an IDE environment,
In this IDE environment, you can create a PSL file and debug the PSL file.
1. Ide Interface
Let's take a look at the IDE environment interface:
: The IDE environment is divided into three panes. The layout of this pane can be customized. The upper-left pane shows the output pane and the result of execution in IDE.
It is used for output. The window in the lower-left corner is the interaction pane, also called the command pane. You can enter the command to be executed in the window, and the current working path is displayed in this pane,
The working path of is: C: \ Users \ vol_20120330, which is the home directory of the current user of my computer. The right pane is used to create
In the PSL file, I typed a simple command: Get-command, which also becomes the script pane.
2. Switch different pane styles
You can use the View menu to change the layout style of different panes. You can also use the toolbar to switch between different la S. You can open ps ise and try it on your own.
3. debugging
Script editedCodeYou can run it to view the results, which can be done through the Debug menu command. As shown in:
We can see that PS ise supports the breakpoint debugging function, which makes up for the disadvantages of the previous script debugging is not easy. Execute the script in cmd
You must use special methods to obtain general debugging information. This feature is enhanced in PS.
4. Run the script
There are three main methods to run scripts in the IDE environment: Debugging menu, shortcut key F5, and toolbar running button. This button and other IDE environment buttons of Microsoft
The shape is the same, it is a green triangle; it is the running result of the executed script file:
Of course, you can also execute scripts in the Command pane, but this is not very convenient, you need to provide the script execution path.
5. Adjust the font
The default font size in several panes is relatively small and looks uncomfortable. The IDE environment provides the function of enlarging and downgrading the font. You can set the font size through menus and shortcut keys.
Shortcut:
CTRL-+ increase the font size
CTRL--Reduce font
6. debugging Functions
Debugging is mainly implemented through breakpoints, and debugging information is also provided.
1) view debugging information
When a command is run incorrectly, ise provides the same error information as that in the PS console. For example
For example, the red font in the output pane indicates the error message, indicating the type and location of the error. The specific error message is meaningful.
I will not explain it here.
2) Insert/delete a breakpoint
ISE supports breakpoint debugging to insert and delete breakpoints ;.
Anyone familiar with other ide environments of Microsoft is familiar with the breakpoint represented by a circle. Here ise makes a great improvement. When the breakpoint is inserted, the highlighted color is used at the breakpoint.
It is easy for people to view the breakpoint. Unlike the circle breakpoint, the breakpoint is much more difficult to distinguish.
3) breakpoint debugging output
After the breakpoint is inserted, click Run or run the F5 command to debug it ;:
Execute to the breakpoint, and the script stops running. The color of the breakpoint in the script window changes, so that you can clearly know
The command pane is changed. As shown above, [dbg] is displayed in the title bar of the command pane, indicating that the command is in debugging mode and the output prompt is changed
">>>". The output pane also displays the position of the breakpoint debugging.
4) debugging
To demonstrate the debugging process, I added a command to the script and started the debugging mode at the same time, for example:
As you can see, the script stops when it runs to the breakpoint. In this case, you can enter a command in the Command pane to obtain some information about the current session, or
Obtain the value of the script variable object, as shown in:
Enter the preceding command and press enter to get the following output:
Through this debugger, you can easily debug your own scripts, greatly speed up the efficiency and accuracy of script development, and deepen the understanding of PS operation;
The complex debugging technology will not be mentioned here. If you are interested, you can try it on your own.
Today, I found that garden's blog feature has been improved: Automatic Storage; I feel this is good, so I can not finish writing it at once, and then write it again.
You don't have to get it late to finish writing.