Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using windows and creating a shortcut to call the following.

\\myserver\myfolder\inv.vbs \\myserver\myfolder\mybat.bat

I have created the VBS script to not show the batch window (run hidden).

inv.vbs = CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

I want to pass a parameter to the batch, something like:

\\myserver\myfolder\inv.vbs \\myserver\myfolder\mybat.bat 2

Where 2 is the parameter. The shortcut will run the batch without showing the window but doesn't pass any arguments to the batch. If anyone has any ideas that would be great.

share|improve this question
It seems like you need to first pass the param to the vbs file then to the batch file from the vbs file. – imtheman Feb 13 '13 at 21:35

(As posted by user198056)

I found the answer. The VBS needs to include the batch file.

dim shell
set shell=createobject("") "cmd /c \\myserver\myfolder\mybatch.bat 2", 0
set shell=nothing

When this VBS is called it passes the parameter to the batch and the batch window is hidden. I'm sorry I don't have the particulars on the syntax.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .