我试图测试一个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)。 –