Old 5th February 2008, 23:18   #1
SimonCropp
Junior Member
 
Join Date: Feb 2008
Posts: 2
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?
SimonCropp is offline   Reply With Quote
Old 5th February 2008, 23:23   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 3,465
nsis is a gui app, not a console program.

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

http://forums.winamp.com/showthread....hreadid=243205

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th February 2008, 23:32   #3
SimonCropp
Junior Member
 
Join Date: Feb 2008
Posts: 2
Wow. Speedy reply. is 5 minutes a record?

Thanks Anders.

With "AttachConsole" as an extra search word i got to this
http://forums.winamp.com/printthread...hreadid=240746

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.
SimonCropp is offline   Reply With Quote
Old 6th February 2008, 00:27   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 3,465
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:
PHP Code:
System::Call 'kernel32::GetStdHandle(i -11)i.r0'
System::Call 'kernel32::AttachConsole(i -1)'
FileWrite $"hello" 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump