Archive: Exec and Standard input


Exec and Standard input
Hello,

I have a need to call a .exe and pass some parameters from the standard input. Someting like:

StrCpy $0 '"my.exe" <inputs.txt'
ExecWait $0

But it seems that this does not work. The 'inputs.txt' file does not seem to be transmitted to the exe.

Am I doing somehting wrong?

Thanks,
T


It's not the windows console, so a < is not supported. Don't that application support a file as command line parameter?

You also don't have to use StrCpy to copy something to a variable to use Exec(Wait).

Just call it like:

Exec '"my.exe"'


No the exe does not support the input as parameters. But I found the answer in a thread about 'execshell problem'.

The trick is to use cmd (defined in %COMSPEC%). The following worked for me:

ExpandEnvStrings $1 %COMSPEC%
StrCpy $0 '"$1" /C "my.exe" < "inputs.text"'
ExecWait $0