测试路径命令不适用于两个要测试的文件



正在使用以下命令测试路径。

    $IMLocation = C:Test
    $AppName = Test
    if (Test-Path  ($IMLocation + "$AppName - include $AppName.msi,$AppName.xml"))

上面的代码返回"false",尽管我在"IMLocation"中有两个文件(msi,xml)。不知道为什么?请帮忙。

试试这个:

$IMLocation = "C:Test"
$AppName = "Test"
if (Test-Path  -path "$IMLocation*" -include "$AppName.msi","$AppName.xml")

最新更新