macOS has a neat feature whereby if you download a zip file, it is automatically extracted. You can disable this feature if you don’t find it useful but most people do. If you’d like to replicate this same feature on Windows 10 you can. It ought to work with just about any browser you use however, it also depends on which folder it is you download the zip file to. In order to automatically extract zip files, you need a batch script, and an app that can detect the zip file and trigger the script to run.
Add 7-zip To Environment Variable
The script will utilize commands that the 7-zip app supports. You’re basically using the script to call the 7-zip app and your OS needs to be able to call the app from anywhere. To do that, you need to add 7-Zip to environment variables on Windows 10. It’s pretty easy to do and we have a brief guide on how to do just that but we’ll summarize the steps here;
1. Open File Explorer and paste the following in the location bar. Tap enter.
Control Panel\System and Security\System
2. In the window that opens, click ‘Advanced System Settings’ on the left.
3. In the System properties window, go to the Advanced tab, and click ‘Environment variables’ at the bottom.
4. In the Environment variable window, look for Path in the list. Select it, and click the Edit button.
5. On the Edit environment variable window, click the Browse button, and select the 7zip folder on your system. It ought to be at the following location;
Open a new Notepad file, and paste the following in. This script needs to be edited.
7z x -o"Path-To-Downloads-Folder*" "Path-To-Extract-File-To\*.zip"
You obviously need to modify the above script with the correct location for the folder you download files to. It’s alright if you don’t save files to the default Downloads. To find the downloads folder, check the next section. Below is an example of what the file ought to look like when you’ve edited it. Save the file with the BAT extension and save it to a dedicated folder of its own.
7z x -o "C:\Users\fatiw\Desktop\*" "C:\Users\fatiw\Desktop\*.zip"
To find the download location, follow the process for your particular browser.
Open Chrome and click the more options button at the top right. Select ‘Settings’ from the menu. Scroll down to the very bottom and expand the Advanced section. Scroll down to the Downloads section to check where you’re saving downloaded files to.
In Firefox, click the hamburger icon at the top right and select ‘Options’ from the menu. On the Options tab, scroll down to the Downloads section to see where files are saved.
Open Edge and click the more options button at the top right. Select Settings from the menu. Scroll down and click ‘View Advanced Settings’. Scroll down to the Downloads section to view which folder Edge is saving downloads to.
The last thing you need to get the script going is something that will trigger the batch script when a new zip file is saved. For that, you need an app called File Watcher Utilities. Download it and extract all its files to the folder you put the batch file in.
It should look something like the screenshot below.
Click Ctrl+N to create a new Daemon and follow these steps;
- Give it a name that tells you what it’s for and in the Browse box, select the folder where you download files to.
- Go to the Filters tab and enter *.zip in the Main file name filter string.
- Next, go to the Processes tab, and in the Process Executable section, select your batch file.
- On this same tab, select the same download location in the Process working directory section.
Start the daemon and download a zip file. You will see a Command prompt window asking to confirm that you want to replace a file. Type Y to proceed.
If you see several Command Prompt windows open, you need to stop the daemon, select it, and click Properties. Go to the File System Events tab, and uncheck the ‘Files or folder created’ event as well as the File or folder deleted events. Leave the other two unchecked and run the daemon again.
To disable the Command Prompt window and automatically allow the file to be extracted, go to the Process Advanced tab in the daemon’s properties and select the Create no window option.