VBS - Auto update script
Automate updates for your VBS (Visual Basic Script) console scripts! Learn how to create a self-updating VBS file that connects to GitHub, checks for new versions, and overwrites itself.
This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.
This article is part of the VBA & MS Office automation series:
- MS Office - How to create a ribbon in Excel
- MS Excel - How to call a SOAP web service
- How to optimize an existing MS Access database
- VBS - Retrieve the list of fields in a MS Access Database
- VBS - Auto update script
- Microsoft Outlook - VBA - Save emails as PDF
- VBS - Get list of files and generate a CSV
- MS Office - Load dropdown from Excel's range
- Export MS Access objects
- MS Excel - Get the list of references used in your modules

This article shows how to give a VBScript (VBS) file a self-update capability: on each run, the script downloads its own source from a public GitHub URL, compares it to the local copy, and overwrites itself if a newer version is found — letting distributed .vbs utilities stay current without manual redistribution.
Before switching to WSL2 and the Linux console, I wrote VBS scripts from time to time. It looks like VBA but for the DOS console.
A VBS script for DOS is a text file written in the Visual Basic Scripting Edition (VBScript) programming language that can be executed directly from the DOS command prompt. It allows you to automate tasks and perform repetitive operations on your computer.
It's just like Linux Bash scripts but for DOS.
Three VBS utilities of mine that would benefit from exactly this self-update mechanism: VBS - Retrieve the list of fields in a MS Access Database, Export MS Access objects and VBS - Get list of files and generate a CSV.
Do you think it would be possible to offer an auto-update function in such scripts? The answer is yes.
Imagine a script called get_folder_size.vbs you've publicly saved on GitHub (source https://github.com/cavo789/vbs_utilities/blob/master/src/folders/get_folder_size/get_folder_size.vbs).
Someone downloads it to their computer and enjoys using it.
By adding a new auto-update function to it, each time the script starts, a connection to GitHub is made first, the script is downloaded from there, and a check is made to see if the downloaded version is different; if so, the script overwrites itself.
Here is the content of such function:
' -----------------------------------------------------------------'' Connect to GitHub, get the raw version of a file and download it'' The script will check for newer version on GitHub and if' there is one, the script will overwrite himself with' that newer version.'' Based on a script of' @author Michi Lehenauer §https://github.com/michiil)' then modified by Christophe Avonture'' @src https://github.com/michiil/vbs_scrips/blob/master/WZV-Excel.vbs' -----------------------------------------------------------------
' The content to downloadurl = "https://raw.githubusercontent.com/cavo789/vbs_utilities/master/src/folders/get_folder_size/get_folder_size.vbs"
Set req = CreateObject("Msxml2.ServerXMLHttp.6.0")
req.setTimeouts 500, 500, 500, 500
' If you're behind a firewall, uncomment the following line' and mention the proxy address and port'req.setProxy 2, "your.proxy.net:8080", ""
req.open "GET", url, Falsereq.send
If Err.Number = 0 Then If req.Status = 200 Then ' Get the content, just downloaded downloadedContent = req.responseText
' Get the original content, this script
scriptName = wScript.ScriptFullName Set objFSO = CreateObject("Scripting.FileSystemObject") Set textFile = objFSO.OpenTextFile(scriptName, 1) originalContent = textFile.ReadAll textFile.Close
' Compare if the two contents are different If (originalContent <> downloadedContent) Then ' If yes, for instance, rewrite this script by ' the new content ==> auto-update Set textFile = objFSO.OpenTextFile(scriptName, 2)
textFile.Write (downloadedContent) textFile.Close
'wScript.echo scriptName & " has been updated" End If
Set textFile = Nothing Set objFSO = Nothing
End IfElse ' Ok, in case of error, don't panic, just do nothing Err.ClearEnd IfThis script downloads a file from GitHub and automatically updates itself if a newer version exists. It connects to a GitHub repository, retrieves the raw content of a VBS script, compares it with the currently running script, and overwrites itself if the downloaded version is different.
This article is part of the VBA & MS Office automation series:
- MS Office - How to create a ribbon in Excel
- MS Excel - How to call a SOAP web service
- How to optimize an existing MS Access database
- VBS - Retrieve the list of fields in a MS Access Database
- VBS - Auto update script
- Microsoft Outlook - VBA - Save emails as PDF
- VBS - Get list of files and generate a CSV
- MS Office - Load dropdown from Excel's range
- Export MS Access objects
- MS Excel - Get the list of references used in your modules




