0

I am trying to pass a vbs variable as an argument into my batch file:

vbs code:

Set WShShell = CreateObject("WScript.Shell")
dim nextday
nextday= DateAdd("d",1,dtmStart)
strRun = "Batch1.bat" & nextday
WshShell.Run(strRun)

batch code:

"C:\AscendQrx\bselstmt.exe" NOCONFIRM DATABASE=ddd var=ccc date=nextday

Getting the error bad syntax.

2
  • Start with putting a space between the name of the .bat and the date: strRun = "Batch1.bat " & nextday. Then in the .bat pick up the (one and only) command line parameter: ... date=%1. Commented Feb 26, 2013 at 21:47
  • possible duplicate of passing variable from vbscript to batch file Commented Feb 26, 2013 at 21:51

1 Answer 1

0

why not run the command from the vbscript instead of calling a batch file? I used to do the same thing before I became more familiar how to use .Run

Try this and let me know

Set WShShell = CreateObject("WScript.Shell")
dim nextday
nextday= DateAdd("d",1,dtmStart)
strRun = "C:\AscendQrx\bselstmt.exe NOCONFIRM DATABASE=ddd var=ccc date=" & nextday
WshShell.Run(strRun)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.