View Single Post
  #3  
Old 09-02-2004, 07:47 PM
jmm jmm is online now
Registered User
 
Join Date: 07-29-2004
Posts: 10
How to run DOS commands in Run Script

Thanks for the reply!

First, when I search the VBP Forum for the keyword "RunProgramEx", why do I get no results?

Second, while I can run calc.exe in your example without problem, I can't use Builder.RunProgramEx the way I need to. I get what I believe to be file-exclusively-opened access problems with the bat-file I wish to run via Builder.RunProgramEx. In the following sub I create a bat-file to execute using Builder.RunProgramEx:

sub RunCmds(cmds, ProjectDir)

Dim MyFso, tf, BatFile, DosCmd

BatFile = "c:\build\RunBuild2.bat"
Set MyFso = vbld_FSO()
Set tf = MyFso.CreateTextFile(BatFile, true)
tf.Write("cd " & ProjectDir & vbCrLf & cmds)
tf.Close

DosCmd = BatFile
Builder.RunProgramEx DosCmd

end sub

The first time I run the job, I get this rather quiet error:
...
1 of 1 project(s) updated
9/2/2004 5:25:18 PM: Build successfully completed.
Error at Line 318, Column 2
Step 'Parse top-level build.bat' failed
Build ended.

Note: Line 318 is "Builder.RunProgramEx DosCmd".

Now when I run it again I get this error:
...
1 of 1 project(s) updated
9/2/2004 5:35:55 PM: Build successfully completed.
Error at Line 312, Column 2 (Permission denied)
Step 'Parse top-level build.bat' failed
Build ended.

Note: Line 312 is "Set tf = MyFso ...".

If I try to delete or change the bat-file outside of VBP, I get access denied errors until I exit VBP.
Reply With Quote