PDA

View Full Version : The run directive



David Webber
06-22-2007, 08:29 AM
This follows on from the thread about using the version number of the installed program as the version number of the installation program.

I have followed the advice, and am happily getting the version number from an ini file. But for various reasons the program which extracts and writes the version number to the ini file in the desired format is a .bat file.

And unfortunately it seems that the #run directive in SB6 does not work on batch files. Is this correct?

Dave

linder
06-22-2007, 01:28 PM
Hi Dave,

Please try "cmd yourbat.bat" in the #run directive. This should work.

Does this help?

Friedrich

David Webber
06-23-2007, 02:24 AM
Hi Dave,

Please try "cmd yourbat.bat" in the #run directive. This should work.

Does this help?

Friedrich

Unfortunately no :-( I have tried various variations on the command line.

cmd by itself does bring up a console window.

"cmd mybat.bat" (with quotes) and
"cmd [path_in_compiler_variable]\mybat.bat"

seem to come closest but no luck. The batch file reads approximately

------
set outputfile_v=version10v.ini
echo [$MOZARTVERSION$] > %outputfile_v%
ProgramVersion mozart32.exe "Value=" >> %outputfile_v%
pause
----

ProgramVersion.exe is a program I wrote some time ago which extracts the version number from the file which is its first argument, and outputs the string which is its second argument followed by the version number to stdout.

If I run the batch file directly it writes the file version10v.ini
From SB6 it doesn't. I added the "pause" statement specifically to see if it was running, but there's no sign of it. (I also have "wait" set and the default directory specified.)

On a different tack, I have also experimented with running exe programs using > on the command line to redirect stdout output to a file, and that doesn't seem to work either.

Sorry if I'm stress testing the #run directive rather. I'm sure there is an altenative way to do what I need, but as I already had the ProgramVersion.exe program (written some time ago to use with other, "brand X" installation software <g>) I thought I might try to reuse it in the laziest way possible!

[BTW I concur with the recent addition to the other thread: a setupbuilder compiler directive to set the version number automatically to match that of one of the installed files would be a very useful addition.]

Dave

linder
06-23-2007, 06:42 AM
Dave,

Hmm, it "should" work. For example, see this thread:

http://www.lindersoft.com/forums/showthread.php?t=2505

I think it should be:

cmd "[path_in_compiler_variable]\mybat.bat"

I'll see if it is possible to add a "#get file info" directive.

Friedrich

David Webber
06-24-2007, 03:05 AM
Dave,

Hmm, it "should" work. For example, see this thread:

http://www.lindersoft.com/forums/showthread.php?t=2505

I think it should be:

cmd "[path_in_compiler_variable]\mybat.bat"

I'll see if it is possible to add a "#get file info" directive.

Friedrich

Forgot to say:

cmd "[path_in_compiler_variable]\mybat.bat"

just opens a console window which sits there doing nothing. However your link has solved the problem. I didn't expect this for executing a batch file (rather than an internal command) but

cmd /c "[path_in_compiler_variable]\mybat.bat"

works fine!

Thanks!

Dave

linder
06-24-2007, 08:48 AM
Perfect, thank you!!!

Friedrich