2013-02-26 61 views
0

我想一个VBS变量作为参数传递到我的批处理文件:通vbs的变量的批处理文件

VBS代码:

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

批号:

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

获取错误的语法错误。

+0

开始把蝙蝠的名称和日期之间的空间:' strRun =“Batch1.bat”&nextday'。然后在.bat中选择(唯一的)命令行参数:'... date =%1'。 – 2013-02-26 21:47:59

+0

[从vbscript传递变量到批处理文件]的可能重复(http://stackoverflow.com/questions/2536695/passing-variable-from-vbscript-to-batch-file) – 2013-02-26 21:51:56

回答

0

为什么不从vbscript运行命令而不是调用批处理文件?我以前做的同样的事情之前,我变得更熟悉如何使用.RUN

试试这个,让我知道

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)