Powershell脚本,用于提取Cab文件内容并将文件移动到新位置

Powershell脚本,用于提取Cab文件内容并将文件移动到新位置,powershell,cab,Powershell,Cab,我得到了14K CAB文件,每个文件包含200个文件,需要解压缩到原始位置 不幸的是,这并不像将它们全部提取到同一位置那么容易:-( 我决定使用PowerShell,并使用SQL为每个文件生成了一个单独文件位置的列表,并且可以提取CAB,不幸的是,它们都提取到当前位置 我正试图将他们转移到各自的位置,但我正在努力 这是代码,到目前为止我已经知道了 $shell_app=new-object -com shell.application $CABfilename= Import-CSV "CABF

我得到了14K CAB文件,每个文件包含200个文件,需要解压缩到原始位置

不幸的是,这并不像将它们全部提取到同一位置那么容易:-(

我决定使用PowerShell,并使用SQL为每个文件生成了一个单独文件位置的列表,并且可以提取CAB,不幸的是,它们都提取到当前位置

我正试图将他们转移到各自的位置,但我正在努力

这是代码,到目前为止我已经知道了

$shell_app=new-object -com shell.application
$CABfilename= Import-CSV "CABFileList.csv" -Header CABfilename | Foreach-object {

$zip_file = $shell_app.namespace((Get-Location).Path + "\$CABfilename")
$destination = $shell_app.namespace((Get-Location).Path)
$destination.Copyhere($zip_file.items())

$dvs = Import-csv "CABFileList.csv" -Header Path, DVSFilename | 

Foreach-object{
    Move-item $_.DVSFilename* $_.Path
}

这是一个老问题,但可能有人会发现答案很有用。我已经修改了我今天制作的一个,从一个农场下载所有WSP并提取其内容

$CABfilename = Import-CSV "CABFileList.csv" -Header CABfilename | Foreach-object {
 # Grab the Solution
$Path = $SaveLocation + $CABfilename
# Check the path is ok
$Path
# Make a copy with extension '.cab' for extraction
$DotCab = $CABfilename + ".cab"
$SolutionDir = $Dotcab -replace '.wsp.cab'
mkdir $SolutionDir
copy-item $CABfilename $DotCab
# Now extract it, assuming you have expand.exe in the filsystem (should be in everything post Server 2008 / Vista)
if(C:\Windows\System32\expand.exe)     {
    try { cmd.exe /c "C:\Windows\System32\expand.exe -F:* $Dotcab $SolutionDir"}
   catch { Write-host "Nope, don't have that, soz."}
}}