Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

(As posted by user198056)

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

dim shell
set shell=createobject("wscript.shell")
shell.run "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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.