Run the commands shown in the example below to permanently customize your PowerShell console windows and make many tasks easier.
Example 1-8. Set-ConsoleProperties.ps1
Push-Location Set-Location HKCU:\Console New-Item '.\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe' Set-Location '.\%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe' New-ItemProperty . ColorTable00 -type DWORD -value 0x00562401 New-ItemProperty . ColorTable07 -type DWORD -value 0x00f0edee New-ItemProperty . FaceName -type STRING -value "Lucida Console" New-ItemProperty . FontFamily -type DWORD -value 0x00000036 New-ItemProperty . FontSize -type DWORD -value 0x000c0000 New-ItemProperty . FontWeight -type DWORD -value 0x00000190 New-ItemProperty . HistoryNoDup -type DWORD -value 0x00000000 New-ItemProperty . QuickEdit -type DWORD -value 0x00000001 New-ItemProperty . ScreenBufferSize -type DWORD -value 0x0bb80078 New-ItemProperty . WindowSize -type DWORD -value 0x00320078 Pop-Location
These commands customize the console color, font, history storage properties, QuickEdit mode, buffer size, and window size.
With these changes in place, you can also improve your productivity by learning some of the hotkeys for common tasks, listed in Table 1-2. PowerShell uses the same input facilities as cmd.exe, and so it brings with it all the input features that you are already familiar with—and some that you aren’t!
| Hotkey | Meaning |
| Up arrow | Scan backward through your command history. |
| Down arrow | Scan forward through your command history. |
| PgUp | Display the first command in your command history. |
| PgDown | Display the last command in your command history. |
| Left arrow | Move cursor one character to the left on your command line. |
| Right arrow | Move cursor one character to the right on your command line. |
| Home | Move the cursor to the beginning of the command line. |
| End | Move the cursor to the end of the command line. |
| Ctrl + Left arrow | Move the cursor one word to the left on your command line. |
| Ctrl + Right arrow | Move the cursor one word to the right on your command line. |
When you launch PowerShell from the link on your Windows Start menu, it customizes several aspects of the console window:
- Foreground and background color, to make the console more visually appealing
- QuickEdit mode, to make copying and pasting with the mouse easier
- Buffer size, to make PowerShell retain the output of more commands in your console history
By default, these customizations do not apply when you run PowerShell from the Start→Run dialog. The commands given in the solution section improve the experience by applying these changes to all PowerShell windows that you open.
The hotkeys do, however, apply to all PowerShell windows (and any other application that uses Windows’ cooked input mode).
This introduction to the Windows PowerShell language and scripting environment provides more than 430 task-oriented recipes to help you solve the most complex and pressing problems, and includes more than 100 tried-and-tested scripts that intermediate to advanced system administrators can copy and use immediately. You'll find hands-on tutorials on fundamentals, common tasks, and administrative jobs that you can apply whether you're on a client or server version of Windows.




Help






