我試圖測試一個UNC路徑是否存在,但所有嘗試都失敗了。 此文件夾例子存在,並返回true:帶通配符的PowerShell測試路徑UNC
\\Server\Path1
我想確認所有文件夾有存在類似的名稱,如:
\\Server\Path2 \\Server\Path3 etc.
我我在這些例子中試過使用通配符:
test-path "\\Server\Path*"
resolve-path "\\Server\Path*"
[System.IO.Directory]::Exists('\\Server\Path*');
Test-Path $('filesystem::\\Server\Path*')
...除了\''*組合的許多排列組合。 但是,使用通配符時,我嘗試過的任何內容都不會返回此類路徑的「真」,即使它似乎可以正常工作:例如,Test-Path c:\windows\system3*
。
你的道路已經是'\\服務器\ C $ \路徑*' –
[相關](https://stackoverflow.com/q/35068220/1630171)。 –