Transcription of PowerShell Cheat Sheet Import, Export, Convert
{{id}} {{{paragraph}}}
Basic CommandsCommon Aliasesgcm foreach,% sortwhere, ? diff, compare dir, ls, gci gicopy, cp, cpi move, mv, mi del, rmrni, ren fFtflgcimcat, gc, typesch, history, ghy ihy, r gp sp pwd, gl gm sls cd, chdir, sl cls, clear Get-CommandForeach-ObjectSort-ObjectWher e-ObjectCompare-ObjectGet-ChildItemGet-I temCopy-ItemMove-ItemRemove-ItemRename-I temFormat-TableFormat-ListGet-CimInstanc eGet-ContentSet-ContentGet-HistoryInvoke -HistoryGet-ItemPropertySet-ItemProperty Get-LocationGet-MemberSelect-StringSet-L ocationClear-HostCommon Aliases$var = "string" $a,$b = 0 or $a,$b = 'a','b' $a,$b = $b,$a $var=[int]5 Assign variableAssign multiple variablesFlip variablesStrongly typed variableVariables$arr = "a", "b"$arr = @()$arr[5] $arr[ ] $arr[1,4+ ] $arr[1] += 200$z = $arA + $arB [pscustomobject]@{x=1;z=2} (Get-Date).DateArray of stringsEmpty arraySixth array elementLast three array elementsElements at index 1,4, 6-9 Add to array item valueTwo arrays into single arrayCreate custom objectDate property of objectArrays Objects#Comment<#comment#>"`"test`""`t `n` CommentMultiline CommentEscape char `Ta bNew lineLine continueComments, Escape Characters=, +=, -=, ++,---and, -or, -not,!
PowerShell Cheat Sheet Common cmdlets Cmdlet Functions Parameter Alias Scripts ... Commands built into shell written in .NET Commands written in PowerShell language Argument to a Cmdlet/Function/Script Shortcut for a Cmdlet or Function Text files with .ps1 extension Existing windows programs Pass objects Get-process word | Stop-Process ...
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}