Write to / Create a file

Got a problem you cannot solve? Try here.
Post Reply
djm
Posts: 34
Joined: Thu Feb 01, 2007 4:39 pm

Write to / Create a file

Post 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.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
djm
Posts: 34
Joined: Thu Feb 01, 2007 4:39 pm

OK, that certainly makes sense

Post by djm »

So how can I write the output of a program to a new file in IA? Is there a function for this?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
djm
Posts: 34
Joined: Thu Feb 01, 2007 4:39 pm

Post 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.
Post Reply