본문 바로가기

Windows 10/PowerShell

PowerShell : Switch

반응형

- Switch

$i=0  

switch($i)  
{  
    0 {Write-Host "0000"}  
    1 {Write-Host "1111"}  
    2 {Write-Host "2222"}  
}
switch("도망")
{
    '도망' {Write-Host "Run"}    
    0 {Write-Host "0000"}    
    1 {Write-Host "1111"}
    2 {Write-Host "2222"}
}

 

 

about_Switch

About Switch In this article --> SHORT DESCRIPTION Explains how to use a switch to handle multiple If statements. LONG DESCRIPTION To check a condition in a script or function, use an If statement. The If statement can check many types of conditions, inclu

docs.microsoft.com

 

반응형

'Windows 10 > PowerShell' 카테고리의 다른 글

PowerSehll : Try, Catch, Finally (예외 처리)  (0) 2019.06.14
PowerShell : Array, 동적 배열  (0) 2019.06.14
PowerSehll : For, While, Break  (0) 2019.06.14
PowerShell : If, ElseIf, Else  (0) 2019.06.14
PowerShell : 주석 처리  (0) 2019.06.14