Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for runnhide.vbs

(view source code of runnhide.vbs as plain text)

  1. Option Explicit
  2.  
  3. Dim i, strArguments, wshShell
  4.  
  5. If WScript.Arguments.Count = 0 Then Syntax
  6. If WScript.Arguments(0) = "/?" Then Syntax
  7.  
  8. strArguments = ""
  9.  
  10. For i = 0 To WScript.Arguments.Count - 1
  11. 	strArguments = strArguments & " " & WScript.Arguments(i)
  12. Next
  13.  
  14. Set wshShell = CreateObject( "WScript.Shell" )
  15. wshShell.Run Trim( strArguments ), 0, False
  16. Set wshShell = Nothing
  17.  
  18.  
  19. Sub Syntax
  20. 	Dim strMsg
  21. 	strMsg = "RunNHide.vbs,  Version 2.00" & vbCrLf _
  22. 	       & "Run a batch file or (console) command in a hidden window" & vbCrLf _
  23. 	       & vbCrLf _
  24. 	       & "Usage:  RUNNHIDE.VBS  some_command  [ some_arguments ]" & vbCrLf _
  25. 	       & vbCrLf _
  26. 	       & "Where:  ""some_command""    is the batch file or (console) command" & vbCrLf _
  27. 	       & "                          you want to run hidden" & vbCrLf _
  28. 	       & "        ""some_arguments""  are optional arguments for ""some_command""" & vbCrLf _
  29. 	       & vbCrLf _
  30. 	       & "Based on a ""one-liner"" by Alistair Johnson" & vbCrLf _
  31. 	       & "www.microsoft.com/technet/scriptcenter/csc/scripts/scripts/running/cscte009.mspx" _
  32. 	       & vbCrLf & vbCrLf _
  33. 	       & "Written by Rob van der Woude" & vbCrLf _
  34. 	       & "http://www.robvanderwoude.com"
  35. 	WScript.Echo strMsg
  36. 	WScript.Quit 1
  37. End Sub
  38.  

page last modified: 2024-02-26; loaded in 0.0197 seconds