PowerShell/PowerShellScript
Pnuskgh (토론 | 기여)님의 2020년 1월 14일 (화) 16:25 판 ("PowerShell/PowerShellScript" 문서를 보호했습니다 ([편집=관리자만 허용] (무기한) [이동=관리자만 허용] (무기한)))
PowerShell Script
PowerShell Script의 확장자는 ps1을 사용 한다.
ps1 Command Line Argument
<code class="powershell">Write-Host "Num Args:" $args.Length; foreach ($arg in $args) { Write-Host "Arg: $arg"; } Write-Host $args[0]</code>
기본 문법
<code class="powershell">#--- -eq, -ne, -gt, -lt if (~ -eq $True) { #--- If문 # if (-Not ~) } elseif (~) { } else { } switch (~) { # switch -wildcard (~) { # switch -regex (~) { # switch (1, 2, 3, 4, 5) { ~ {} {$_ -gt 3} {} default {} } for ($i = 0; $i -lt 10; $i++) { } foreach ($arg in $args) { } while (~) { }</code>