Powershell

Powershell comands and tips

All ​cmdlets are named in a ​Verb-Noun pattern, such as Get-Process, Get-Content, and Stop-Process.

For commands that modify data, PowerShell supports ​-WhatIf and ​-Confirm parameters that let you see what a command would do: ​

PS > gps [b-t]*[c-r] | Stop-Process –whatif

Save command history to a file

PS > Get-History | Foreach-Object{$_.CommandLine} > c:\temp\script.ps1

notepad c:\temp\script.ps1

Run a command with spaces in it

  • Precede with the invoke operator (&)

e.g.

& '.\Program With Spaces.exe' arguments

Last updated