我已经创建了这个简单的代码,但是得到了“ Expand-Archive:路径'C:\ Users \ XXX \ C $ \ temp \ Oracle Clients \ win32_11gR2_client.zip”不存在或不是有效文件系统路径。”
我只是想将$ destinationRoot提取到$ targetRoot文件夹中。我想念什么?
[String] $KfxComputers = "C:\temp\Kofax Apps\servers.txt"
# This file contains the list of servers you want to copy files/folders
to
$computers = get-content -Path $KfxComputers
$destinationRoot = 'C$\temp\Oracle Clients\win32_11gR2_client.zip'
$targetRoot = 'C$\temp\Oracle Clients\win32_11gR2_client'
foreach ($computer in $computers) {
$testpath = Test-Path -Path \\$computer\$destinationRoot
if ($testpath)
{
Write-Host "extract file..." -ForegroundColor green
Expand-Archive -Path $destinationRoot -DestinationPath $destinationRoot -Force -ErrorAction SilentlyContinue
Write-Host "Completed" -ForegroundColor Green
}
Else {
Write-Host "Failed" -ForegroundColor green
}
}