title: Force a VBS to run using cscript instead of wscript
body: <p>What is the stackoverflow approved (and hence correct) method to force a VBS to run using cscript instead of wscript - irrespective of what the user tries?</p>
  
  <p>A quick Google search shows plenty of examples, but some of them simply don't work and those which do often don't handle the fact that it may have been run with arguments so I'm keen to know what the best way is.</p>
  
  <p>Here is one example which doesn't handle arguments:</p>
  
  <pre><code>sExecutable = LCase(Mid(Wscript.FullName, InstrRev(Wscript.FullName,"\")+1))
  If sExecutable &lt;&gt; "cscript.exe" Then
    Set oShell = CreateObject("wscript.shell")
    oShell.Run "cscript.exe """ &amp; Wscript.ScriptFullName &amp; """"
    Wscript.Quit
  End If
  </code></pre>
  
  <p>I appreciate that this could probably be easily modified to handle arguments, but realise that this may not be the best way to approach the problem.</p>
  
  <p>Background: I'm writing a script which can run by double clicking or (most likely) from either a DOS batch file or as a scheduled task. It can contain one or more optional command line arguments.</p>