Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: How run a batch file from VBS script?

57 views
Skip to first unread message

AndreasH_Ha

unread,
Jul 1, 2008, 6:40:08 AM7/1/08
to
Please try to use the function "ExtProgram". As you will see from the online help, it allows to starts an executable and it also supports running a batch file.
Andreas

Malankoalan

unread,
Jul 1, 2008, 7:40:11 AM7/1/08
to
Perfect! I haven't had the chance yet to try it out with the right file but it seems to be working the way I want.
Thank you!
/Malin

Malankoalan

unread,
Aug 12, 2008, 4:40:08 AM8/12/08
to
Hello again!
 
It worked fine just writing Call Extprogram(variables for path and file name), thank you!
 
However, now I've done some other changes in the program and the Extprogram suddenly stopped working. The prompt pops up but it doesn't run the batch file. It's strange since I didn't change anything on this particular line. Could it be that I'm in the wrong folder or something? I've tried writing the whole path instead of using variables but it doesn't help.
 
Thanks in advance for help!
/Malin

Brad Turpin

unread,
Aug 12, 2008, 5:10:11 PM8/12/08
to
Hi Malin,
Try adding explicit " characters around your DOS path, the same way you would in a DOS window.  If the file path has spaces in it, this is the only way to get it to work:
Call ExtProgram("""C:\My Folder\My Batch File.bat""")
Brad TurpinDIAdem Product Support EngineerNational Instruments

Brad Turpin

unread,
Aug 13, 2008, 11:10:17 AM8/13/08
to
Hi Malankoal..., Just for completeness, you can still add the extra " characters even if your file path is stored in a variable: Call ExtProgram("""" & batFilename_ & """") But I'll move on from there because you said the batch file is being called OK every time.  I'm no DOS or batch file expert, but if you say that your batch file needs to be in the same directory as the data files it's supposed to process, then if it were me I would copy the batch file into the data file directory with FileCopy(), run the batch file in the data file directory with ExtProgram(), then delete the batch file from that directory with FileDelete(). Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 new messages