Written by:R Teachout7/3/2008 8:49 AM
Hate the vbs scripts that output results, and when you run them from wscript, you have to click 'OK' a few hundred times? Ensure it is running from cscript with this little bit of code.
Here's a snippet of code that I use at the top of vbs files to ensure they are only run from a command line, because I hate having to click 'OK' hundreds of times. if lcase(right(Wscript.FullName, 11)) <> "cscript.exe" then wscript.echo "*****************************************************************" & VbCrLf & _ "How to use this: 'cscript " & Wscript.ScriptName & " ARGUMENT" & VbCrLf & _ "*****************************************************************" wscript.quit 0 end if