Skip to content
⌘ NSIS Forum Archive

write to command line when silent

4 posts

SimonCropp#

write to command line when silent

I would like to put write some messages to the command line when my installer is running in silent mode (by passing the /S flag).

I tried searching the forums and Google for various combinations of “command line”, “silent” “console” and “nsis” with no luck. Also looked through the manual.
Both resulted in plenty of information about passing input over the command line and the command line options for makensis.

I also tried calling the command “Exec ‘echo sdfsdfsdf’” from within my script. Still no love.

I am probably missing something obvious but could someone please point me to it?
Anders#
nsis is a gui app, not a console program.

Calling AttachConsole(ATTACH_PARENT_PROCESS) etc. with the system plugin might work

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
SimonCropp#
Wow. Speedy reply. is 5 minutes a record?

Thanks Anders.

With "AttachConsole" as an extra search word i got to this
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


The script towards the bottom seems to work.
Will have a go at refining the code to make it a little more usable and post my results.
Anders#
Turns out I made example code for someone in the nsis IRC channel a long time ago to handle this

Comparing Instructor's code with mine and my notes, you should call GetStdHandle first, then AttachConsole, and use the built in FileWrite command and not WriteConsole, if you do this, you can use pipes and redirection (foo.exe > out.txt etc.) still limited to XP and up

so, without any error handling or anything:
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
System::Call 'kernel32::AttachConsole(i -1)'
FileWrite $0 "hello"