Batch Script to Download Zip File and Unzip it Automatically via Commad Prompt



Sometimes I realize when I download archive file like zip, it pains me to unzip it manually by mouse. So I decided to create a shell script (in windows is batch script) that can perform download of the zip file and instantly unzip and delete zip file from command prompt. It needs curl and unzip library to have installed to your system.

@echo off

curl -sS %1 > temporary.zip && unzip temporary.zip && rm temporary.zip

I saved it as fetchzip.bat

So whenever i wanna download zip file i called this in command prompt

fetchzip http://the/url/of/the/file.zip

It'll fetch the zip file to the current directory, rename it to "temporary.zip", extract the content using unzip, and delete the zip file.

To make the batch script can be called anywhere. Don't forget to add the batch script to environment variable like explained in this article.