我试图提取大约 40 个文件夹,每个文件夹都包含一个 rar,但我从未在 powershell 中做过。在 bash 中,您可以使用*/*.rar通配符来提取它们,但是如何在 powershell 中执行此操作?我尝试了一些东西
C:\Program Files (x86)\Unrar\UnRAR.exe' x .\*\*.rar
Run Code Online (Sandbox Code Playgroud)
但它错误:
UNRAR 4.10 freeware Copyright (c) 1993-2012 Alexander Roshal
Cannot read contents of .\*\*.rar
The filename, directory name, or volume label syntax is incorrect.
Run Code Online (Sandbox Code Playgroud)
小智 5
我用这个:
$parent = 'c:\myrar_files'
$files = @()
Get-ChildItem $parent -Recurse -Filter "*.rar" | % {
# Recurse through all subfolders looking for .rar files only.
$files = $files + $_.FullName
}
foreach ($f in $files) {
# UnRAR the files. -y responds Yes to any queries UnRAR may have.
C:\scripts\WinRAR\unrar x -y $f
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4708 次 |
| 最近记录: |