Scripting Tech on Windows

By Xah Lee. Date: . Last updated: .

In 2009, i Switching from Mac/Unix to Windows, after 10 years as a programer and sys admin on the unix environment. This page is my learning notes about scripting tech on Windows.

Here's a table listing technologies on unix and Windows that have similar purposes.

Unix vs Windows Automation Tech
ShellBash cmd.exe, PowerShell cmd.exe aka batch script is old. PowerShell is new with Windows 7.
Application ScriptingAppleScript (OSX)VBA (MS Office)VBA = Visual Basic for Applications. On linux, lang varies depending on the app; typical are Python, Perl, Tcl , Scheme lisp , JavaScript variant.
Advanced sys adminPerl, PythonVBScript, PowerShell
Web ServerPHP, Perl, PythonActive Server Pages Active Server Pages (ASP) uses JScript (JavaScript) or VBScript (Visual Basic) as langs.
Web Client SideJavaScriptJavaScript, VBScript

What is the difference between Visual Basic, VBA, VBScript, Visual Basic .NET?

They are the same language just differ a bit because of the context. However, they don't run on the same engine (but they do share the use of many Microsoft's component tech such as COM and DLL).

The latest version of the classic Visual Basic is VB 6. VB 6 is no longer supported. It is replaced by the .NET version, and it has version naming starting at VB 7 and currently VB 10. However, VB 6 will still be included in Windows 7. VB 6 will probably be around for many years in practice.

What is the difference between VBScript, Windows Script Host, and PowerShell?

Basically, MS-DOS,, cmd.exe are all meant to be the same thing, but with different implementation. This is similar to unix command line evolution sh → tcsh → bash.

Windows Script Host (WSH) is created in late 1990s, because cmd.exe is not powerful for scripting. WSH is bundled with Windows 98. Quote:

The Microsoft Windows Script Host is an automation technology for Microsoft Windows operating systems that provides scripting capabilities comparable to batch files, but with a greater range of supported features.

It is language-independent in the sense that it can make use of different scripting language engines. By default it interprets and runs plain-text JScript (.JS and .JSE files) and VBScript (.VBS and .VBE files). Users can install different scripting engines to enable them to script in other languages, for instance PerlScript. The language independent file name extension WSF can also be used. The advantage of the Windows Script File (.WSF) is that it allows the user to use a combination of scripting languages within a single file.

WSH is just a hosting engine, it needs scripting engines such as VBScript (Visual Basic) and JScript (JavaScript).

In 2006, Microsoft released PowerShell, which is a new shell design based on .NET technology. PowerShell is more versatile and powerful than WSH+VBScript because it can be used interactively as a shell like cmd.exe, and it is also a full scripting lang that are fully integrated with the .NET platform, and can use all .NET libraries. Going forward, PowerShell is a replacement for the whole cmd.exe and WSH bag. PowerShell comes pre-instaled with Windows 7.

What is Active Scripting?

Active Scripting (aka ActiveX Scripting) is more or less a marketing term that MS uses collectively to describe MS's scripting tech, including JScript, VBScript, ASP (Active Server Pages), WSH (Windows Script Host). Active Scripting is deprecated by MS's .NET Framework .

In unix, you script using bash, shell tools (For example, find, grep, sed, awk, make), or perl and python. In Windows, scripting are done with VBScript and now PowerShell.

Visual Basic is one of the most important way to script Windows for sys admin as well as writing standalone Windows applications. Its role is similar to Python or Perl, but unlike unix's scripting techs which are largely all independent, Visual Basic is tightly integrated and dependent on various Microsoft's component technology to work.

When scripting Windows for sys admin tasks, often you'll also make use of Windows Management Instrumentation (WMI) and Active Directory Service Interfaces (ADSI).

Meaning of “Shell” in unix and Windows

In unix world, a “shell” refers to the command line interface to the OS.

In Windows, Windows Shell refers to the whole GUI, in particular the file manager File Explorer , and taskbar and Start Menu .

The Windows command line interface is called Command Prompt, and the program name is “cmd.exe”. It is to be replaced by PowerShell in Windows 7.

“script” and “batch file”

In unix world, a “script” refers to text file of shell commands or constructs. In Windows, a file of cmd.exe commands is often called a Batch file instead. However, PowerShell or VBScript files are still called scripts.

Terminal vs Console

In unixes, to run a shell, you start a Terminal emulator , which is configured to start bash or tcsh.

(in linuxes, the terminal emulator app is often xterm , and on OS X the program is called Apple Terminal .)

Terminal Emulator or Console are terminologies from the 1970s and 1980's, and their meaning is a bit fuzzy now. Physical Terminal or Console has been pretty much obsolete since late 1990s. The terms “terminal emulator” or “console” today mostly just refer to a command line app.

In windows, its terminal is called Win32 console , which hosts the cmd.exe and PowerShell.

In unixes, you start the terminal app, which then is configured to automatically start a shell such as bash. In windows, you don't do that. You start the cmd.exe or powersell process directly. These programs are written with the Windows Console as its interface.


For scripting tasks on Windows sys admin, you need to know basics of cmd.exe. For advanced admin, you need to master VBScript, which is the bread and butter tool right now. Visual Basic is important because it is among the top 5 most used language. (the top langs include: Java, C, C++, PHP, Visual Basic, C#, Python, Perl, JavaScript) Going forward, you should learn PowerShell, which is included with Windows 7 and posed to replace cmd.exe and VBScript for sys admin tasks.

PowerShell Tutorial

PowerShell Tutorial

See also: Windows Console Keyboard Shortcuts