Windows – WinRAR Command Line Extraction and Replace

batchcmd.exewindowswinrar

I need to figure out how to use the WinRAR command line in order to extract a zip file into a specific directory, and replace any files that are already there. (tl;dr is I need to extract and replace via winrar commandline)

So if I had a texts.zip file that contained 1.txt 2.txt 3.txt and I also had C:\texts\ which contained random-junk.pdf more-junk.png 1.txt 2.txt 3.txt, I need my batch file to extract texts.zip into C:\texts\ and for it to leave the the pdf and png alone (these are just examples) but replace the txt files which are meant to represent an already existing file, with the new ones from the zip.

Any help is very apreciated, thank you all!

Best Answer

I found this website with a commands overview, hope it helps. See the x page for help on extracting.

Update: According to this SO question the options should be -o+

This info should all be in the help file provided with your WinRAR installation. Open the help, look for "Command line mode" and then the sub-topics "Commands" and "Switches".

Update: should look like this:

WinRAR x -o+ texts.zip *.txt C:\texts\
Related Question