How to Auto-Update Your System Utilities or Web Files with a Script

By Jason Faulkner on January 12th, 2012

image

One of the great things about most system utilities is their portability. Many simply are distributed directly as an exe or in a zip file and are ready to use with no install required. Because of the simplicity of use, these types of applications are easily updated, however many lack any form of auto-update capability. Our UpdateFromWeb script solves this problem as it makes installing updates to portable applications, or any file available via the web for that matter, an automated process.

Usage

The UpdateFromWeb script usage is pretty simple and we have provided several examples below. You simply provide the source URL and the directory where the files to be updated on your computer are located and the script does the rest.

Features include:

  • Universal – works for any tools or files on any URL
  • Directory scanning for updating all applicable files in a local directory (including subdirectories)
  • Automatic unzipping and extraction
  • Direct URL downloads for single file updates
  • Case conversion for websites where URLs are case sensitive
  • New file detection for only updating newer versions
  • Automatic shutdown and restart of running applications which need to be updated
  • Can be run on demand or automated

There are more features included which are documented in the script file. Just open it in Notepad (or any other text editor) to view all the options.

The UpdateFromWeb script makes use of a couple of external tools which will need to be on your system prior to use. The download links for these tools are provided below and need to be placed in a folder in your system’s PATH variable (if in doubt, just put these required files in C:\Windows).

Not Just for Tools or Applications

As mentioned above, the UpdateFromWeb script can be used for any file which has a consistent URL. For example, if a project is updated nightly using the URL mysite.com/project.zip, you can use the UpdateFromWeb script to automatically download and extract the zip file to a local folder on your machine.

On a similar note, you can use the script to keep files and/or tools consistent across multiple machines. Just upload a file to a central location and an automated process running UpdateFromWeb can handle the rest.

Examples

The UpdateFromWeb script can be both used from the command line or hardcoded. Additionally, you can mix and match as needed.

Below are some examples which demonstrate the usage as well as the respective execution settings for both the command line and hardcode.

Update all SysInternals tools located in “C:\My Tools” and restart any running applications which were updated:

Command line:

UpdateFromWeb /U:http://live.sysinternals.com/tools /D /R “/T:C:\My Tools”

Hardcode:

SET URL=http://live.sysinternals.com/tools

SET TargetDir=C:\My Tools

SET UpdateDir=1

SET RestartStopped=1

 

Update all Nirsoft tools located in “C:\My Tools” and all subdirectories:

Command line:

UpdateFromWeb /U:http://www.nirsoft.net/utils /D /S /Z /L “/T:C:\My Tools”

Hardcode:

SET URL=http://www.nirsoft.net/utils

SET TargetDir=C:\My Tools

SET UpdateDir=1

SET Recurse=1

SET ToLower=1

SET Unzip=1

SET RestartStopped=1

 

Update the file named “Specs.doc” from mysite.com and copy it to “C:\Files\Latest Specs.pdf”:

Command line:

UpdateFromWeb /U:http://mysite.com/Specs.pdf “/F:Latest Specs.pdf” /T:C:\Files

Hardcode:

SET URL=http://mysite.com/Specs.pdf

SET TargetDir=C:\Files

SET FileToGet=Latest Specs.pdf

 

Update the files in the “C:\Files” directory with latest files from Specs.zip on mysite.com:

Command line:

UpdateFromWeb /U:http://mysite.com/Specs.zip /D /N /Z /T:C:\Files

Hardcode:

SET URL=http://mysite.com/Specs.zip

SET TargetDir=C:\Files

SET UpdateDir=1

SET CopyNewFiles=1

SET Unzip=1

 

Update all files in the “C:\Files” to be in sync with the files stored on mysite.com/files:

Command line:

UpdateFromWeb /U:http://mysite.com/files” /D /T:C:\Files

Hardcode:

SET URL=http://mysite.com/files

SET TargetDir=C:\Files

SET UpdateDir=1

 

 

Download Update From Web Script

Download Download.exe Tool

Download 7-Zip Command Line Tool

Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 01/12/12
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!