OpsaC - Operating as PowerShell code
published: July 1, 2016 author: Tinu tags: Regex categories: PowerShell
Mit einer Regex-Auswertung auf Yes oder No abfragen:
$ret = Read-Host 'Would you create a file? [Y] Yes, [N] No'
if($ret -match '^y')
{
Write-Output "Yes ($($ret))"
}
elseif($ret -match '^n')
{
Write-Output "No ($($ret))"
}