尝试从zip powershell中提取文件,但不包括.inf

时间:2014-11-26 11:50:14

标签: powershell zip

Trying to extract just .sql files from zip powershell

参考上面的链接,创建了一个powershell脚本来仅提取.sql文件。

有没有办法扭转这种情况,因此除了.Inf文件之外,它还从Zip文件中提取所有内容。

任何帮助将不胜感激,因为我的powershell技能几乎没有。

$shell = New-Object -COM 'Shell.Application'

$zipfile     = 'C:\Powershell\From here\1-5'
$destination = 'C:\Powershell\To Here'
$zip = $shell.NameSpace($zipfile) 

$zip.Items() | ? { $_.Path -notlike '*.inf' } | % {
  $shell.NameSpace($destination).CopyHere($_)
}

1 个答案:

答案 0 :(得分:0)

如果您发布了代码会很有帮助,但一般情况下,您可以使用-notlike-notmatch等操作符来实现您的目标。