PDQ.com mobilePDQ.com desktop
Support

PowerShell: Console Window Tips

Kris PowellKris Powell
·

If you use PowerShell on a regular or semi-regular basis you may already know these tricks of the trade, but in case you were not aware here are some neat tricks to use in the PowerShell console window.

Tab Completion

Go ahead and type a partial command and press your Tab key. PowerShell magically knows what you’re trying to look for, or at least it will venture an educated guess.

Get-Da should autocomplete to Get-Date.

You can even press Tab (and Shift-Tab) multiple times to cycle through multiple matches.

Get- should autocomplete to multiple commands. Just keep pressing Tab to cycle forwards alphabetically and press Shift-Tab to cycle backward alphabetically.

This is great for typing commands more quickly or for trying to type commands that you may not fully remember.

Show Recent Command List

You can show all recently typed commands at a console window by tapping the F7 key. You can then select a command by highlighting it and hitting the Enter key.

Scroll Through Recent Commands

You type a command and realize you have a syntax error. Rather than type the command all over again, you can simply tap the Up arrow key to scroll backwards through your recent commands. You can tap the Down arrow key to scroll forwards.

Pause Results On Screen

Have you ever run a command that output more results than fit the screen? Usually, the results will zoom past faster than most of us can read, so we often find ourselves having to scroll to view the results.

No more!

There are two common methods for accomplishing this:

| Out-Host -Paging

| more

Something to note, however, is that it will evaluate the results of a command before outputting them to the console window.

I know that there are many other tips that each of us have come across (aliases, for example). Please feel free to add any suggestions to the comments below so that other readers may be able to benefit from your experience!

Did you know that PDQ Deploy has a PowerShell step you can use to deploy your scripts?


This blog post is part of a series on Powershell:

Don't miss the next post!

SQL UNION vs UNION ALL

UNION is one of the four basic ‘set operators’ in SQL. The UNION operator is used to combine the results of two or more SELECT Statement queries into a single result-set, excluding duplicate values.

SQLite
SQL UNION
SQL UNION ALL
SQL Operator
SQL Set Operator