I am looking for a command in the windows terminal that allows me to unrar all the files from a folder. Precisely I want to replicate this bash command on windows
find . -name "*.rar" -exec unrar x -o+ {} \;
thank u
I am looking for a command in the windows terminal that allows me to unrar all the files from a folder. Precisely I want to replicate this bash command on windows
find . -name "*.rar" -exec unrar x -o+ {} \;
thank u
Well Powershell would be a great option, something like this should do the trick:
Get-ChildItem -File *.rar | Foreach {unrar x -o+ $_.fullname}
I would prefer RS Finance's answer: a power shell provides an easy and clean solution. However, if that's not an option, you may achieve the same with command prompt like this (first cd
to the correct directory),
for %i in (*.rar) do "C:\Program Files\7-Zip\7z.exe" e "%i"
I use 7z as my zip program. You just have to replace the path to whatever you use. If you have the path stored in you environment path, "7z.exe" without the absolute path may be enough.
Note that,
e
is an argument specifically for 7zip, meaning extract.It's better to use UnRAR.exe supplied with WinRAR Trial. This console utility is freeware, and definitely supports all RAR format versions
e.g.
for %i in (*.rar) do "C:\Program Files (x86)\WinRAR\UnRAR.exe" x "%i"
to extract all archives contents with relative paths or
for %i in (*.rar) do "C:\Program Files (x86)\WinRAR\UnRAR.exe" e "%i"
to extract everything to the same folder