| 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>CodeMirror: Powershell mode</title> |
| 6 | <link rel="stylesheet" href="../../doc/docs.css"> |
| 7 | <link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 | <script src="../../lib/codemirror.js"></script> |
| 9 | <script src="../../addon/edit/matchbrackets.js"></script> |
| 10 | <script src="powershell.js"></script> |
| 11 | <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> |
| 12 | </head> |
| 13 | <body> |
| 14 | <div id=nav> |
| 15 | <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 16 | |
| 17 | <ul> |
| 18 | <li><a href="../../index.html">Home</a> |
| 19 | <li><a href="../../doc/manual.html">Manual</a> |
| 20 | <li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 21 | </ul> |
| 22 | <ul> |
| 23 | <li><a href="../index.html">Language modes</a> |
| 24 | <li><a class=active href="#">JavaScript</a> |
| 25 | </ul> |
| 26 | </div> |
| 27 | <article> |
| 28 | <h2>PowerShell mode</h2> |
| 29 | |
| 30 | <div><textarea id="code" name="code"> |
| 31 | # Number Literals |
| 32 | 0 12345 |
| 33 | 12kb 12mb 12gB 12Tb 12PB 12L 12D 12lkb 12dtb |
| 34 | 1.234 1.234e56 1. 1.e2 .2 .2e34 |
| 35 | 1.2MB 1.kb .1dTb 1.e1gb |
| 36 | 0x1 0xabcdef 0x3tb 0xelmb |
| 37 | |
| 38 | # String Literals |
| 39 | 'Literal escaping''' |
| 40 | 'Literal $variable' |
| 41 | "Escaping 1`"" |
| 42 | "Escaping 2""" |
| 43 | "Escaped `$variable" |
| 44 | "Text, $variable and more text" |
| 45 | "Text, ${variable with spaces} and more text." |
| 46 | "Text, $($expression + 3) and more text." |
| 47 | "Text, $("interpolation $("inception")") and more text." |
| 48 | |
| 49 | @" |
| 50 | Multiline |
| 51 | string |
| 52 | "@ |
| 53 | # -- |
| 54 | @" |
| 55 | Multiline |
| 56 | string with quotes "' |
| 57 | "@ |
| 58 | # -- |
| 59 | @' |
| 60 | Multiline literal |
| 61 | string with quotes "' |
| 62 | '@ |
| 63 | |
| 64 | # Array and Hash literals |
| 65 | @( 'a','b','c' ) |
| 66 | @{ 'key': 'value' } |
| 67 | |
| 68 | # Variables |
| 69 | $Variable = 5 |
| 70 | $global:variable = 5 |
| 71 | ${Variable with spaces} = 5 |
| 72 | |
| 73 | # Operators |
| 74 | = += -= *= /= %= |
| 75 | ++ -- .. -f * / % + - |
| 76 | -not ! -bnot |
| 77 | -split -isplit -csplit |
| 78 | -join |
| 79 | -is -isnot -as |
| 80 | -eq -ieq -ceq -ne -ine -cne |
| 81 | -gt -igt -cgt -ge -ige -cge |
| 82 | -lt -ilt -clt -le -ile -cle |
| 83 | -like -ilike -clike -notlike -inotlike -cnotlike |
| 84 | -match -imatch -cmatch -notmatch -inotmatch -cnotmatch |
| 85 | -contains -icontains -ccontains -notcontains -inotcontains -cnotcontains |
| 86 | -replace -ireplace -creplace |
| 87 | -band -bor -bxor |
| 88 | -and -or -xor |
| 89 | |
| 90 | # Punctuation |
| 91 | () [] {} , : ` = ; . |
| 92 | |
| 93 | # Keywords |
| 94 | elseif begin function for foreach return else trap while do data dynamicparam |
| 95 | until end break if throw param continue finally in switch exit filter from try |
| 96 | process catch |
| 97 | |
| 98 | # Built-in variables |
| 99 | $$ $? $^ $_ |
| 100 | $args $ConfirmPreference $ConsoleFileName $DebugPreference $Error |
| 101 | $ErrorActionPreference $ErrorView $ExecutionContext $false $FormatEnumerationLimit |
| 102 | $HOME $Host $input $MaximumAliasCount $MaximumDriveCount $MaximumErrorCount |
| 103 | $MaximumFunctionCount $MaximumHistoryCount $MaximumVariableCount $MyInvocation |
| 104 | $NestedPromptLevel $null $OutputEncoding $PID $PROFILE $ProgressPreference |
| 105 | $PSBoundParameters $PSCommandPath $PSCulture $PSDefaultParameterValues |
| 106 | $PSEmailServer $PSHOME $PSScriptRoot $PSSessionApplicationName |
| 107 | $PSSessionConfigurationName $PSSessionOption $PSUICulture $PSVersionTable $PWD |
| 108 | $ShellId $StackTrace $true $VerbosePreference $WarningPreference $WhatIfPreference |
| 109 | $true $false $null |
| 110 | |
| 111 | # Built-in functions |
| 112 | A: |
| 113 | Add-Computer Add-Content Add-History Add-Member Add-PSSnapin Add-Type |
| 114 | B: |
| 115 | C: |
| 116 | Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item |
| 117 | Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession |
| 118 | ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData |
| 119 | Convert-Path ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString |
| 120 | ConvertTo-Xml Copy-Item Copy-ItemProperty |
| 121 | D: |
| 122 | Debug-Process Disable-ComputerRestore Disable-PSBreakpoint Disable-PSRemoting |
| 123 | Disable-PSSessionConfiguration Disconnect-PSSession |
| 124 | E: |
| 125 | Enable-ComputerRestore Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration |
| 126 | Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter |
| 127 | Export-Csv Export-FormatData Export-ModuleMember Export-PSSession |
| 128 | F: |
| 129 | ForEach-Object Format-Custom Format-List Format-Table Format-Wide |
| 130 | G: |
| 131 | Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint |
| 132 | Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date |
| 133 | Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Help |
| 134 | Get-History Get-Host Get-HotFix Get-Item Get-ItemProperty Get-Job Get-Location Get-Member |
| 135 | Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive |
| 136 | Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-Service |
| 137 | Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb |
| 138 | Get-WinEvent Get-WmiObject Group-Object |
| 139 | H: |
| 140 | help |
| 141 | I: |
| 142 | Import-Alias Import-Clixml Import-Counter Import-Csv Import-LocalizedData Import-Module |
| 143 | Import-PSSession ImportSystemModules Invoke-Command Invoke-Expression Invoke-History |
| 144 | Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod |
| 145 | J: |
| 146 | Join-Path |
| 147 | K: |
| 148 | L: |
| 149 | Limit-EventLog |
| 150 | M: |
| 151 | Measure-Command Measure-Object mkdir more Move-Item Move-ItemProperty |
| 152 | N: |
| 153 | New-Alias New-Event New-EventLog New-Item New-ItemProperty New-Module New-ModuleManifest |
| 154 | New-Object New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption |
| 155 | New-PSTransportOption New-Service New-TimeSpan New-Variable New-WebServiceProxy |
| 156 | New-WinEvent |
| 157 | O: |
| 158 | oss Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String |
| 159 | P: |
| 160 | Pause Pop-Location prompt Push-Location |
| 161 | Q: |
| 162 | R: |
| 163 | Read-Host Receive-Job Receive-PSSession Register-EngineEvent Register-ObjectEvent |
| 164 | Register-PSSessionConfiguration Register-WmiEvent Remove-Computer Remove-Event |
| 165 | Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-Module |
| 166 | Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData |
| 167 | Remove-Variable Remove-WmiObject Rename-Computer Rename-Item Rename-ItemProperty |
| 168 | Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service |
| 169 | Restore-Computer Resume-Job Resume-Service |
| 170 | S: |
| 171 | Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias |
| 172 | Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item |
| 173 | Set-ItemProperty Set-Location Set-PSBreakpoint Set-PSDebug |
| 174 | Set-PSSessionConfiguration Set-Service Set-StrictMode Set-TraceSource Set-Variable |
| 175 | Set-WmiInstance Show-Command Show-ControlPanelItem Show-EventLog Sort-Object |
| 176 | Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction |
| 177 | Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript |
| 178 | Suspend-Job Suspend-Service |
| 179 | T: |
| 180 | TabExpansion2 Tee-Object Test-ComputerSecureChannel Test-Connection |
| 181 | Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command |
| 182 | U: |
| 183 | Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration |
| 184 | Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction |
| 185 | V: |
| 186 | W: |
| 187 | Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog |
| 188 | Write-Host Write-Output Write-Progress Write-Verbose Write-Warning |
| 189 | X: |
| 190 | Y: |
| 191 | Z:</textarea></div> |
| 192 | <script> |
| 193 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 194 | mode: "powershell", |
| 195 | lineNumbers: true, |
| 196 | indentUnit: 4, |
| 197 | tabMode: "shift", |
| 198 | matchBrackets: true |
| 199 | }); |
| 200 | </script> |
| 201 | |
| 202 | <p><strong>MIME types defined:</strong> <code>application/x-powershell</code>.</p> |
| 203 | </article> |
| 204 | </body> |
| 205 | </html> |