PowerShell ISE Keyboard Shortcuts
In a previous article I provided an introduction to the PowerShell ISE, which is most likely your initial choice for a PowerShell scripting tool. PowerShell is all about efficiency, and I want to extend that to writing scripts in the ISE. One of the best ways to be efficient is to keep your hands on the keyboard. It may not seem like much, but every little bit of time you save by not having to grab the mouse and finding something to click, adds up.
Windows PowerShell ISE Keyboard Commands
In this post, we’ll dive a bit deeper into how you can execute key features with PowerShell ISE keyboard shortcuts that are available. You’ll also learn additional ways you can customize the PowerShell ISE to meet your own preference and working style.
Creating New Files and Tabs
When you open the PowerShell ISE, you automatically get a new, untitled script pane. If you want to start a new script file, then use Ctrl+N. Remember, if prefer your script and console panes full size, then use Ctrl+R to toggle between the two. While working on your script, don’t forget to save your work. Yes, the PowerShell ISE will save work in the background in the event the ISE suddenly ends. But I like to make sure my work is saved with the Ctrl+S keyboard shortcut. If the script has never been saved, then you’ll get a dialog box to specify the location and file name.
You can also create a new PowerShell tab with the Ctrl+T shortcut. This is like a new instance of the PowerShell ISE. It will have an entirely new scope, and its own editor, which means you can open a different set of files. Using different tabs is handy when you are working on different projects and want to avoid problems with scope.
When you need to open an existing file you have a couple of efficient techniques. One approach is to use the Ctrl+O (that is an O as in Open) shortcut. Navigate to the folder and select one or more files to open. Or, in the command pane use the built-in PSEDIT function.
PS C:Scripts> psedit .CoolScript.ps1
The function needs to be able to resolve the path to the file. You can’t pipe to the function, but you can use a parenthetical expression to load multiple files at once.
PS C:Scripts> psedit (dir c:workwin*.xml)
This example will load all of the XML files in C:Work that start with ‘Win.’
Adjusting Font Sizes
If you have been around for a while, then you might find the ISE a bit hard to see. Fortunately, it is extremely easy to increase and decrease the font size. These changes affect both the script editor and command pane. Although you could use the slider in the lower right hand corner, keep your hands on the keyboard and use Ctrl++ to increase and Ctrl+- to decrease. If you know you always want the ISE to be zoomed to a particular setting, add a line like this to your PowerShell ISE profile script.
I’ll cover the $psISE object in future articles.
The ISE Profile
Your ISE profile doesn’t exist by default. You can see the value by looking at the $profile variable in the ISE.
PS C:> $profile C:UsersJeffDocumentsWindowsPowerShellMicrosoft.PowerShellISE_profile.ps1
Like the console profile script, this file, nor the WindowsPowerShell folder, exist by default. Create the file and paste in any commands you want to run, like the zoom setting, when the PowerShell ISE starts. The profile will run every time you open a new tab in the PowerShell ISE. You might consider adding a command to set the default location to your Scripts folder.
Or if you prefer that your script pane always be maximized, add this line:
Again, I’ll explain about $psise in a future article.
If you have multiple files open, use the Ctrl+Tab keyboard shortcut to cycle between them. Unfortunately, I can’t find any native Windows keyboard shortcuts to cycle through ISE tabs. But, I have worked out a PowerShell alternative, which I’ll share in a future article because it uses material beyond the scope of this particular article.
When it comes time to close files and the ISE, again keep your fingers on the keyboard. Use Ctrl+F4 to close the current file. If it has not been saved you will be prompted to save it. I have not found any standard shortcuts to close ISE tabs, but I’ll be back later with a PowerShell solution. To close the ISE, use the standard Windows shortcut Alt+F4.
Learning these keyboard shortcuts takes time. It’s all about muscle memory. You don’t write scripts with a mouse, so the more you can keep your fingers on the keyboard, then the more efficient you will become. I hope you’ll be on the lookout for more articles on mastering the PowerShell ISE.
More in PowerShell
How to Create Files and Folders with PowerShell
Jun 22, 2022 | Mike Kanakos
How to Use PowerShell For Loop, While Loop, and Other Loops
May 23, 2022 | Ivan Mirchev
How to Check Your PowerShell Version
May 4, 2022 | Michael Reinders
How to Download a File using PowerShell
Apr 21, 2022 | Michael Reinders
How to Write and Run a PowerShell Script File on Windows 11
Apr 4, 2022 | Ivan Mirchev
Microsoft’s New PowerShell Crescendo Tool Facilitates Native Command-Line Wraps
Mar 21, 2022 | Rabia Noureen
Most popular on petri