Archive: Echoing to Std out, Std err


Echoing to Std out, Std err
Currently I am using an automated tool, which can deploy a batch file to a machine, and then runs the files and can read the echo from them.

Is there a way to write to Standard Out / Err, or simulate an echo.

Thanks, James


Why not use nsExec?


Originally posted by Joel
Why not use nsExec?
I have tried nsExec already, doesn't seem to work. I can use nsExec and Echo. to a log file, which works. But when I tried to just use Echo with it, it doesn't seem to get picked up.

I have tried Exec, ExecToStack, ExecToLog, all of them I can echo to a log, but without putting this to a log, it seems to get lost, and the application pushing this, doesn't seem to see the Echo's.

Has anyone tried this successfully? Maybe i'm doing it wrong?

May be I misunderstood something, but it looks like you want stdin (echo input) emulation for you console application. You can add one line of code to ExecDos plug-in to use app's stdout as echo stdin (ExecDos.c, add as line 148, not tested):


WriteFile(hInputWrite, b, 1, &rslt, NULL);

Here is what I am trying, so that the app deploying and running my .exe can see what the app is echoing. I'm trying to echo from the installer when installing, so that echo's from the app, can be seen in Standard Out.

nsExec::ExecToLog 'cmd /c Echo. %computername% - INSTALLER - Installing temp installation files >> "$INSTDIR\temp\${installfile}.log"'

nsExec::ExecToLog 'cmd /c type $INSTDIR\temp\${installfile}.log'

I have also tried

nsExec::Exec 'cmd /c Echo. %computername% - INSTALLER - Installing temp installation files >> "$INSTDIR\temp\${installfile}.log"'

nsExec::Exec 'cmd /c type $INSTDIR\temp\${installfile}.log'

I have also tried

nsExec::Exec 'cmd /c Echo. %computername% - INSTALLER - Installing temp installation files'


NSIS is not a console application. It can't write the console it was executed from because it's detached of it.


Originally posted by kichik
NSIS is not a console application. It can't write the console it was executed from because it's detached of it.
Does this mean it's impossible to write to Standard Out then?

You can recompile NSIS as a console application, but that'd probably cause a console window to show up when an installer is executed outside of any console.


I saw in release 2.15, they mentioned this...

Added NSIS_CONFIG_LOG_STDOUT configuration option for logging to stdout.

Is anyone using this right now, and successfully writing straight to stdout?


That setting will build NSIS as a console application with a side-effect of enabling logging. It'll allow you to write to the parent console, but will also create a new console, if executed outside of a console.

To avoid the logging, go to line 59 in Source\exehead\SConscript, remove the condition line and keep only the Append line.