VBScript or VBS is a Microsoft interpreted script version of the Visual Basic programming language, it uses most of its grammar but has some limited resources compared, like some VB keywords doesn't work. It can be used on ASP, HTA and mainly as standalone scripts, executed by Windows Script Host (WSH) or CScript to do automated tasks on Microsoft Windows Operating Systems. It can use COM to access some Windows more advanced resources like Network, Databases, System data, Registry, Schedule, Printing, Active Directory and some other resources. VBScript came first by default on Windows 98 and it is being shipped in every Windows OS since then. However, Microsoft wants to make it a optional add-on from Windows 11 onwards. Today it is on its version 5.8 and was created by Alan Cooper. It is a more advanced and more useful language compared to Batch Script, but it is outdated since PowerShell was released as a more advanced language for Windows Admins and Hackers. You can identify a VBS file by its suffix in the end of the files names, like: example.vbs or as an encrypted version, like: example.vbe. The main advantages to use VBS are:
- considered an easy to learn & use programming language
- can use to open programs and send keypresses including control/shift/alt keys
- can be used as a quick test automation tool
- lightweight and fast interpreted
- can easily make automation scripts for Windows OS
- updated compared to CMD
- shipped with every Windows until its 11th version
- faster to learn, easier and simpler than PowerShell
And the disadvantages:
- outdated compared to Powershell
- does not fully support OOP
- few support from Microsoft, community an lacks of tools
- can't access Win32 API, even less .NET framework, can only COM/DCOM interfacing
- sometimes it is hard to debug what exactly is wrong
- does not receives more updates since some years ago
Your first "hello world"
On Windows, create a file where you want, and put this code inside:
MsgBox "Hello, World!"
and save the file with the name hello.vbs, your file should change its icon to this:
now you can double click the file and it should execute showing the message box! Congrats, you made your first "Hello World" in VBS.