简体   繁体   中英

Batch file not running correctly when called from Visual Basics

I am attempting to write code that will call a batch file, wait until it is complete and then move on to the next line of code in Visual Basic. The code I have does open the batch file, however it does not actually execute. It opens the cmd window and displays some non-code I've written, but does not execute. I've tested the batch file by clicking it and running through cmd and it works fine. Just doesn't run through VBS.

Dim objShell As Object

Set objShell = CreateObject("Wscript.Shell")
Wait = True
objShell.Run """C:\Users\wjones\Documents\Data Loader\Scheduler\process.bat""", 1, Wait

尝试这个:

objShell.Run "cmd /c C:\Users\wjones\Documents\Data Loader\Scheduler\process.bat", 1, Wait

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM