1
$installLocation = "C:\hello\world"
$packageName = "hello"
Write-Host "if ("$installLocation" -match '${packageName}|bla') {"
if ("$installLocation" -match '${packageName}|bla') {
Write-Host "hello";
}
if ("$installLocation" -match 'hello|bla') {
Write-Host "world";
}
当前结果如何查找变量并使用结果在PowerShell中进行匹配?
if (C:\hello\world -match 'hello|bla') {
world
预期成果
if (C:\hello\world -match 'hello|bla') {
hello
world