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>



참조 : PowerShell/PowerShellScript