2013-02-26 67 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)