Page 1 of 1

Write to / Create a file

Posted: Mon Feb 12, 2007 6:02 pm
by djm
I need to create a file from the output of running a program I have in support files.

On the command-line I would run this:

c:\\> prog.exe arg1 arg2 > prog.out

In IA, I'm trying to use "Run Program"

Code: Select all

~InstallAware Clipboard Data~
~Run Program~
~{95E1D5DF-32DA-47F2-AE88-4C07EE92926E}~
~$SUPPORTDIR$\\prog.exe~
~TRUE~
~$arg1$ $arg2$ > $PROGRAMFILES$\\Product X\\prog.out~
~TRUE~
~~


Will/Should this work? I'm unable to get it to work.

Posted: Mon Feb 12, 2007 8:28 pm
by MichaelNesmith
Using pipes and redirection of output of a command line application actually requires cmd.exe, the command line interpreter. In fact, its this cmd.exe program that actually handles all the output piping and so on (and not Windows on a kernel level, for example).

So what you are seeing is normal.

OK, that certainly makes sense

Posted: Mon Feb 12, 2007 8:39 pm
by djm
So how can I write the output of a program to a new file in IA? Is there a function for this?

Posted: Tue Feb 13, 2007 1:27 am
by MichaelNesmith
Capturing the output of a console program is a complex task, and there is no built in support for it in InstallAware at this time, sorry. You can of course call cmd.exe and pass it the necessary command line parameters - that ought to work.

Posted: Wed Feb 14, 2007 5:31 pm
by djm
I've been trying to get this working with cmd now for a while.
I've been unable to get things working using $SUPPORTDIR$ and $TARGETDIR$, so I thought I'd just take out those "variables" from the equation and try running the program directly from somewhere on disk and I can't even get that working:

Code: Select all

~InstallAware Clipboard Data~
~Run Program~
~{DBDCCDE3-5A58-4CD5-8004-CCE6745AD49F}~
~$WINSYSDIR$\\cmd.exe~
~FALSE~
~/c "C:\\Program Files\\Product X\\bin\\some.exe" 12345 67890 > "C:\\Program Files\\Product X\\bin\\license.out"~
~TRUE~
~GENLICFILE~


This creates no file, however I'm certain the commands work because I've cut/paste the exact command on a cmd.exe command line and it generates the license.out file.

Code: Select all

cmd /c "C:\\Program Files\\Product X\\bin\\some.exe" 12345 67890 > "C:\\Program Files\\Product X\\bin\\license.out"


Can anyone confirm that this should work using "Run Program"? Is there any other way with IA to capture output from a "Run Program"?

Thanks.