' Open a script in a console window when started by clicking on it (started through wscript)
'
Option Explicit
' Check if running under "WScript", and if so, relaunch myself cscript and exit
If InStr(1, WScript.FullName, "WScript.exe", vbTextCompare) <> 0 Then
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c cscript /nologo """ & WScript.ScriptFullName & """", 1, False
WScript.Quit(0)
End If
' If we make it to here, we're running under cscript with a cmd window
WScript.Echo "Using: " & WScript.FullName
WScript.Echo "...Do stuff in cscript here..."
WScript.Sleep(5000)
VBScript/Windows Scripting Host (WSH). Mostly for automation and system administration tasks.
At least it's better than using batch (sometimes)!