UseWScript...





4
Date Submitted Tue. Dec. 5th, 2006 2:50 PM
Revision 1 of 1
Scripter Casper42
Tags VBSCRIPT | wscript
Comments 0 comments
This was an update someone else's snippet...
VBScript is a graceful language and Windows Scripting Host cleans up after itself, so this is a compact version for simple usage - reducing code bloat is what small scripts are for.

Just my $.02...

UseWScript

Sub Main
        msgbox "Using " & WScript.Name, 64, "Script Check"
End Sub

Sub UseWScript()
  if (instr(LCase(WScript.FullName),"wscript.exe")=0) then
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run WScript.ScriptFullName
    WScript.echo "Using " & Right(WScript.FullName,11) & ", will now close and launch using WScript"
    WScript.Quit
  else
    'Execute Main process only if using WScript
    Main
  end if
end sub
 

Jeremy Edmiston

Comments

There are currently no comments for this snippet.

Voting