0
我有這個簡單的腳本,似乎不工作。Powershell匹配子句
param ($where, $what)
Write-Host "Finding in '$where' - '$what'"
if (!$what -match "\.sql$")
{
$what += ".sql"
Write-Host "Unmatched..."
}
else
{
Write-Host "Matched..."
}
Write-Host "Finding in '$where' - '$what'"
#Get-ChildItem $where $what -Recurse
輸出總是說不應該是Matched...
。令人驚訝的是,匹配行本身在交互式環境中運行時表現正確。
PS C:\Users\sjoshi> .\sc1 -where "." -what "*s*"
Finding in '.' - '*s*'
Matched...
Finding in '.' - '*s*'
有什麼想法這裏發生了什麼?
我的壞...您的回覆後,我改變(($什麼-match「\ $名爲.sql 「)),並工作。感謝Sunit – Sunit 2011-02-04 21:36:26