2012-09-12 25 views

回答

1

Test-Path c:\docs\*wut* -PathType Leaf

+0

這應該是一個評論,不是答案。 – Arkadiy

+0

尋找作爲字符串的文件名稱 –

+0

什麼是-PathType葉子 –

0
$fileExhists = Get-ChildItem C:\docs -Recurse -Include *.* | Select-String wut 

那麼我可以這樣做:

if(!$fileExhists){} 

但這真的心不是我想要的。這是遞歸的,不會返回一個布爾值。

+0

只要刪除'-Recurse'開關 – latkin

+0

其實,這不是你想要的。這將搜索「wut」文件的**內容**,而不是文件名。 – latkin

1

@latkin看法是正確的,只是使用通配符路徑例如爲:

Test-Path wut* 

Test-Path C:\Docs\*wut* 
相關問題