How To Automatically Extract ZIP Files After Downloading
See more articles by Jon →
ZIP files are necessary for combining multiple files together into one downloadable file. You can get many files in one lump while also compressing the file to allow for a quicker download. This has become a necessary method of downloadingportable filesfor USB or other uses. While it’s necessary to unzip these files witha tool like WinRAR or 7-Zip, it always must be done manually. Today, however, we’ll look at how to set up a few things to automatically unzip a compressed file so you can get to the files within in much quicker.
The steps necessary to automatically unzip ZIP files is to run a batch file that uses 7-Zip against a download location so it extracts the contents and then discards the original ZIP file. This is done with a folder monitoring software. While these steps may seem daunting at first, they are simply using versatile utilities that must be adapted for this project, and therefore must be precise.
Walk through these step by step and you’ll have no problem setting it up.
Set Up 7-Zip
7-Zip is necessary for using the command line operations of its extraction capabilities.
Step 1:Install 7-Zip from this linkhere.
Step 2:Open theSystemProperties by right-clickingComputerfrom the Start menu and choosingProperties.
Step 3:ClickAdvanced system settingsfrom the left pane. This will open theSystem Propertieswindow.
Step 4:Click theAdvancedtab and then chooseEnvironment Variables.
Step 5:Double-click the variable calledPATHand enter a semicolon at the end of the value. Immediately following the semicolon, enter the path to the 7-zip installation directory. The path in this example isC:\Program Files\7-Zip, but yours may be slightly different.
Ensure toOKout of all the open windows to save the variable change. This step is necessary for when we call the 7-Zip program from the command line.
Create a Batch File that Extracts a ZIP File Using 7-Zip
Now that 7-Zip has been installed, it’s necessary to create a small program that will extract any ZIP file in a certain folder.
Before starting, it’s important to note where your downloads go. Whether you’re using Chrome, Firefox, Internet Explorer, etc., every downloaded file is either automatically sent to a certain folder or the browser asks you where the download should go.
Cool Tip:Visit this linkfor a few download managers you can use in Chrome.
If the downloads go to the same folder every time, identify this folder and jot it down. If you choose where every downloaded file will go, simply ensure you choose a common one and then use that location in the below command.
Step 1:Open Notepad and enter the following for the first line:
7z x –oDOWNLOAD-LOCATION* EXTRACT-LOCATION*.zip
For example, this is what my first line of commands is:
7z x -oC:\Users\Jon\Downloads\DownloadedFiles* C:\Users\Jon\Downloads\DownloadedFiles*.zip
Note:There isnota space after the command7z x –oand before theDOWNLOAD-LOCATIONsection. There also cannot be any spaces in the pathname to the downloads folder.
At this point, when the batch file runs, any ZIP file in the downloads folder will extract automatically and land in a folder in the same directory with the same name as the compressed file. However, the original ZIP file still remains. This is unnecessary and may even cause issues when we move on to the remaining steps. Therefore, we must include a command to either remove the ZIP file or move it out of the way and into its own folder.
Step 2:If you’d like to move the downloaded ZIP to another folder, create a folder calledZIP-Originalsand place it in your downloads folder.
Step 3:Add the following under the existing commands in Notepad:
move DOWNLOAD-LOCATION*.zip DOWNLOAD-LOCATION\ZIP-Originals
This is what mine ends up as:
move C:\Users\Jon\Downloads\DownloadedFiles*.zip C:\Users\Jon\Downloads\DownloadedFiles\ZIP-Originals
Alternatively, if you’d like to simply remove the downloaded ZIP file, use this command instead:
del DOWNLOAD-LOCATION*.zip
Step 4:Save this file anywhere as one with a.batextension under theAll Filesfile type.
Run the Batch File When a ZIP File is Downloaded
To automatically run a batch file upon the criteria of a new download, it’s necessary to use a program calledDirectory Monitor.
Step 1:Download Directory Monitor from this linkhere.
Cool Tip:Learn howWatch 4 Foldercan also monitor folder activity.
Step 2:Open the program and choose the three small dots to browse for a download directory.
Find the folder and click theSelect Folderbutton.
Step 3:Right-click the newly added directory and clickEdit.
Step 4:Ensure theNew Filescheckbox is checked under theEvents and Optionssection. Move down a bit further underExecute Applicationsto browse for the batch file you created inStep 4above. Next toOnly execute,enter a small number like3or5so the batch file is sure to run only when the file has been completely downloaded.
Step 5:Return to the main menu after saving the changes and openFile > Options.
Choose to load the program at system start and then add.zipas a global include pattern in the bottom right text area. This ensures that ZIP files are included in the criteria to launch the batch file.
Note:ZIP files aren’t the only file types 7-Zip can handle. Therefore, if you would like to set these steps up with a RAR, 7Z, DMG, etc. compressed file, simply change every instance of ZIP with the preferred extension type.
Conclusion
Extracting ZIP files shortly after download without intervening in the process will surely make using the files that much quicker. The task is fully automatic and can be left alone after setting it up.
Was this helpful?
Last updated on 02 February, 2022
Read Next
The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.
More in Windows
How to Add Amazon App Store on Windows 11
How to Change Taskbar Color in Windows 11
JOIN THE NEWSLETTER
Get Guiding Tech articles delivered to your inbox.
© 2024 Guiding Tech Media. All Rights Reserved.