{"id":11211,"date":"2012-02-08T00:01:00","date_gmt":"2012-02-08T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/02\/08\/learn-keyboard-tricks-to-use-the-powershell-ise-easier\/"},"modified":"2012-02-08T00:01:00","modified_gmt":"2012-02-08T00:01:00","slug":"learn-keyboard-tricks-to-use-the-powershell-ise-easier","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/learn-keyboard-tricks-to-use-the-powershell-ise-easier\/","title":{"rendered":"Learn Keyboard Tricks to Use the PowerShell ISE Easier"},"content":{"rendered":"<p><b>Summary<\/b>: Learn how to use the Windows PowerShell ISE more effectively by leveraging keyboard shortcuts.<\/p>\n<p><span><span><span><span><span><span><span><span><img decoding=\"async\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\" \/><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>&nbsp;Hey, Scripting Guy! I am the network administrator for a large company, and we have to go through very rigorous testing before we can download and install software on our servers. This requirement has prevented me from using many of the community based script editors. I can use the Windows PowerShell ISE because it comes with Windows, and it is therefore considered part of the operating system. Unfortunately, it seems a bit cumbersome to use. Is there a way I can use some shortcuts to make things a bit easier to use? For example, I do not like having to use the mouse when I am working because it is a bit erratic.<\/p>\n<p>&mdash;WS<\/p>\n<p><span><span><span><span><span><span><span><span><img decoding=\"async\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\" \/><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>Hello WS,<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. This week I have been busy at work on the <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/02\/04\/the-2012-windows-powershell-scripting-games-all-links-on-one-page.aspx\" target=\"_blank\">2012 Scripting Games<\/a>. I have written several events now, and I am pleased with the shape the events are taking. I think this year&rsquo;s games are going to be a good challenge for both the beginner and advanced scripts. You should check out the <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/02\/05\/2012-scripting-games-study-guide-a-resource-for-learning-powershell.aspx\">2012 Scripting Games Study Guide<\/a>, and begin digging into the information that I provided about the ten areas of concentration for this year&rsquo;s events. If you have time, you may also want to review study guides from the previous years. You&rsquo;ll find them on the <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/02\/04\/the-2012-windows-powershell-scripting-games-all-links-on-one-page.aspx\" target=\"_blank\">All Links on One Page<\/a>. (You should book mark this page and keep it handy for the next several months, because I will be adding links to this page on a regular basis.)<\/p>\n<p>WS, this is the third blog in a series about using the Windows PowerShell ISE. On Monday, I talked about how to <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/02\/06\/use-the-powershell-ise-to-work-with-long-commands.aspx\" target=\"_blank\">Use the Windows PowerShell ISE to Work with Long Commands<\/a>. In that blog, I contrasted some of the advantages (and disadvantages) of using the Windows PowerShell ISE as opposed to using the Windows PowerShell console. On Tuesday, I wrote <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2012\/02\/07\/learn-how-to-use-the-free-powershell-ise-to-edit-scripts.aspx\" target=\"_blank\">Learn How to Use the Free PowerShell ISE to Edit Scripts<\/a>. In that blog, I covered the script execution policy, clearing the output pane, and a number of keyboard shortcuts that make cutting, copying, and pasting code in the Windows PowerShell ISE easier to accomplish.<\/p>\n<p>Today, I want to continue the discussion about keyboard shortcuts in the Windows PowerShell ISE. To create a new script pane (or to add a new tab to the Windows PowerShell ISE), click the paper icon on the tool bar. To open a script for editing, click the folder on the tool bar. To save the script, click the floppy disk icon on the tool bar. These icons are shown in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8547.hsg-2-8-12-1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8547.hsg-2-8-12-1.png\" alt=\"Image of tool bar\" title=\"Image of tool bar\" \/><\/a><\/p>\n<p>Not all of the capabilities are available via the tool bar. Other capabilities, such as opening a Windows PowerShell ISE tab that works against a remote machine, are available via the <b>File<\/b><i> <\/i>menu. Here are a list of keyboard shortcuts that perform the same actions.<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p><b>Command<\/b><\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p><b>Keyboard shortcut<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>New Script (pane)<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + N<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Open Script (or other file)<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + O<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Save<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + S<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Save As<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Alt +F + A<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Run<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>F5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Run Selection<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>F8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>New PowerShell Tab<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + T<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Close PowerShell Tab<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + W<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>Close Script<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + F4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"319\" valign=\"top\">\n<p>New Remote PowerShell Tab<\/p>\n<\/td>\n<td width=\"319\" valign=\"top\">\n<p>Ctrl + Shift + R<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>One of the interesting things about the Windows PowerShell ISE is the use of multiple tabs, and multiple script panes. The easiest to understand are multiple script panes. Opening the Windows PowerShell ISE automatically opens a blank script pane. If I then open a script, it appears on a new script pane, and the original blank pane still appears. If I open three scripts, there will be four script panes: the original blank script pane, and the three panes that contain the three newly opened scripts. This scenario is shown in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6303.hsg-2-8-12-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6303.hsg-2-8-12-2.png\" alt=\"Image of tool bar\" title=\"Image of tool bar\" \/><\/a><\/p>\n<p>One thing to keep in mind is the title of the <i>untitled <\/i>script pane changes based upon how many times it opens or closes. In the previous image, the <i>untitled <\/i>script pane is up to <i>untitled11.ps1. <\/i>This means 10 untitled scripts have opened and closed (perhaps they were saved as scripts, or simply discarded.)<\/p>\n<p>A new Windows PowerShell tab is not quite as easy to understand, because at first glance it does not appear to work. A new Windows PowerShell tab is tied to the command pane and to the output pane, but not to the script pane. In fact, a new Windows PowerShell tab does not create a new script pane at all. In the following image, you can see that the <i>PowerShell 1 <\/i>tab contains the output that is associated with the <b>Get-Process <\/b>cmdlet.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7652.hsg-2-8-12-3.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7652.hsg-2-8-12-3.png\" alt=\"Image of tool bar\" title=\"Image of tool bar\" \/><\/a><\/p>\n<p>In the image that follows, the <i>PowerShell 6 <\/i>tab appears. It contains the results of the <b>Get-Service <\/b>cmdlet.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0336.hsg-2-8-12-4.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0336.hsg-2-8-12-4.png\" alt=\"Image of tool bar\" title=\"Image of tool bar\" \/><\/a><\/p>\n<p>Using multiple Windows PowerShell tabs is a great way to execute long running commands, and to see the output from multiple commands. In addition, it is an excellent way to work with multiple remote systems at the same time.<\/p>\n<p>WS, that is all there is to using the command line with the Windows PowerShell ISE. Windows PowerShell ISE Week will continue tomorrow when I will talk about more cool things.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to use the Windows PowerShell ISE more effectively by leveraging keyboard shortcuts. &nbsp;Hey, Scripting Guy! I am the network administrator for a large company, and we have to go through very rigorous testing before we can download and install software on our servers. This requirement has prevented me from using many of [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,3,4,45,100],"class_list":["post-11211","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell","tag-windows-powershell-ise"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to use the Windows PowerShell ISE more effectively by leveraging keyboard shortcuts. &nbsp;Hey, Scripting Guy! I am the network administrator for a large company, and we have to go through very rigorous testing before we can download and install software on our servers. This requirement has prevented me from using many of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/11211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=11211"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/11211\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=11211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=11211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=11211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}