I'm trying to extract about 40 folders with each containing a rar, but I never have done in it powershell. In bash you can use /.rar to extract them using a wildcard, but how do I this in powershell ? I tried something along

C:\Program Files (x86)\Unrar\UnRAR.exe' x  .\*\*.rar 

But it errors:

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.
link|improve this question

feedback

1 Answer

Test this first because I don't have anything to test it on:

get-childitem -recurse -filter *.rar | %{"C:\Program Files (x86)\Unrar\UnRAR.exe" x $_.fullpath}

I'm not 100% sure if the x will cause it to extract to the current directory or the directory of the rar file so you may have to add a cd to the commands.

get-childitem -recurse -filter *.rar | %{cd $_.directory; "C:\Program Files (x86)\Unrar\UnRAR.exe" x $_.name}
link|improve this answer
The first one gives me: >> The second one gives me: pastebin.com/KX7ifaaZ – Lucas Kauffman Feb 2 at 16:29
What version of PowerShell are you using? – Scott Warren Feb 2 at 20:32
Ehm The standard one in windows 7 :/ – Lucas Kauffman Feb 2 at 21:04
Try the first one again, I had an unterminated quote. – Scott Warren Feb 3 at 15:56
Unexpected token 'x' in expression or statement. At line:1 char:84 + get-childitem -recurse -filter *.rar | %{"C:\Program Files (x86)\Unrar\UnRAR.exe" x <<<< $_.fullpath} + CategoryInfo : ParserError: (x:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken – Lucas Kauffman Feb 3 at 16:10
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.