Example: confidence

PowerShell Cheat Sheet Import, Export, Convert

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).

PowerShell Cheat Sheet Common cmdlets Cmdlet Functions Parameter Alias Scripts Applications Pipelines Ctrl+c Left/right Ctrl+left/right Home / End Up/down Insert F7 Tab / Shift-Tab 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 ...

Tags:

  Sheet, Teach, Powershell, Powershell cheat sheet

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of PowerShell Cheat Sheet Import, Export, Convert

1 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).

2 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,!-eq, -ne-gt, -ge-lt, -le-replace-match, -notmatch-like, -notlike-contains, -notcontains-in, -notinAssign values to variableConnect expressions / statementsEqual, not equalGreater than, greater than or equalLess than, less than or equal Hi -replace H , P Regular expression matchWildcard matchingCheck if value in arrayReverse of contains, , Logical, Comparison If(){} Elseif(){ } Else{ }while(){}For($i=0; $i -lt 10.)

3 $i++){}Foreach($file in dir C:\){$ } | foreach{$_}Flow ControlScriptsHelpExport-CliXMLC onvertTo-XMLE xport-CSVC onvertTo-CSVI mport-CliXMLC onvertTo-HTMLI mport-CSVC onvertFrom-CSVI mport, Export, Convert -Confirm-WhatIfPrompt whether to take actionDisplays what command would doParameterscd, chdir, slcat, gc, typeacsccopy, cp, cpidel, erase, rd, ri, rm, rmdirmi, move, mvsinisleepsajbcompare, diffgroupcurl, iwr, wgetmeasurenalrvparujbset, svshcmsortsasvsaps, startsujbwjb?, whereecho, writeSet-LocationGet-ContentAdd-ContentS et-ContentCopy-ItemRemove-ItemMove-ItemS et-ItemNew-ItemStart-Sleep Start-Job Compare-ObjectGroup-ObjectInvoke-WebRequ estMeasure-ObjectNew-AliasResolve-PathRe sume-JobSet-VariableShow-CommandSort-Obj ectStart-ServiceStart-Process Suspend-JobWait-JobWhere-ObjectWrite-Out putCommon cmdletsPowerShell Cheat SheetCmdlet Functions Parameter Alias Scripts Applications Pipelines Ctrl+c Left/right Ctrl+left/right Home / End Up/down Insert F7 Tab / Shift-Tab Commands built into shell written in.

4 NETC ommands written in PowerShell languageArgument to a Cmdlet/Function/ScriptShortcut for a Cmdlet or FunctionText files with .ps1 extensionExisting windows programsPass objects Get-process word | Stop-ProcessInterrupt current commandNavigate editing cursorNavigate a word at a timeEnd Move to start / end of lineMove up and down through historyToggles between insert/overwrite modeCommand history in a windowCommand line completionWriting output and reading "This displays a string"Write-Host "color" -ForegroundColor Red -NoNewLine$age = Read-host "Please enter your age"$pwd = Read-host "Please enter your password" -asSecureStringClear-HostString is written directly to outputString with colors, no new line at endSet $age variable to input from userRead in $pwd as secure stringClear consoleGet-CommandGet-Command -Module RGHSGet-Command Get-p*Get-help get-processGet-Process | Get-MemberGet-Process| format-list -properties *Get all commandsGet all commands in RGHS moduleGet all commands starting with get-pGet help for commandGet members of the objectGet-Process as list with all propertiesSet-ExecutionPolicy -ExecutionPolicy.

5 "\\c-is-ts-91\c$\scripts\ &"\\c-is-ts-91\c$\scripts\ ".\ $profileBypass Set execution policy to allow all scriptsRun script in current scopeRun script in script scopeRun script in script scopeYour personal profile that runs at launch


Related search queries