Archive: Command Prompt Install


Command Prompt Install
Hello,
I am facing two problems with NSIS scripts. I am new on this but if someone could help me would be great...

I have to do a installer that runs from a command prompt. I have to set some parameter that the user needs to set (I have done that already), but if the user doesn´t pass the parameter the installer should show a message on command prompt usage: installer.exe -d <directory>

the other problem is that when I run the uninstall i have to zip the directory and save to a backup, I saw all the plugins but they just extract zip files they don´t create one...

can anyone help me?


To create Zip files you could include a copy of 7za.exe (7-zip.org) and extract and execute that (with ExecDos/nsExec). The executable is a little on the heavy side but I'm not sure if there are any other freely available command line zippers out there.

Stu


I have coded this several times for other people, try a forum search next time...

On XP and later it can be done perfectly: http://forums.winamp.com/showpost.ph...79&postcount=4

For older platforms, there is no AttachConsole so you would have to call AllocConsole instead on those systems


Thanks a lot guys...
Was very helpfull


Hi guys,

I have done this way... thanks for the help :up:


StrCpy $R0 "$\r$\n $R0 $\r$\n"
StrLen $R4 $R0
System::Call "kernel32::AttachConsole(i -1)i .r0"
StrCmp $0 0 end
System::Call "kernel32::GetStdHandle(i -11)i .r0"
System::Call "*(i 0)i .r1"
System::Call "kernel32::WriteConsole(i r0, t R0, i R4, i r1, i 0)"
System::Free $1
System::Call "kernel32::FreeConsole()"
end:

You should not use writeconsole to write plain ansi text, use WriteFile (If you use WriteFile, the output can be redirected and/or piped)


Hum ok...
I changed to
System::Call "kernel32::WriteFile(i r0, t R0, i R4, i r1, i 0)"

well I have another question Anders...

Is there a way to keep the prompt right after the command? like

c:\>example.exe -d d: <here comes the error message>

instead of what is doing now
c:\>example.exe -d d:
c:\> Error Message


Originally posted by marcellokera
I changed to
System::Call "kernel32::WriteFile(i r0, t R0, i R4, i r1, i 0)"
The nsis FileWrite command calls WriteFile (See the link I posted)

As far as the newline goes, the answer is yes and no. The short answer is, NO. The long answer is, you have full control over the console buffer and can do anything you want to it by calling the correct windows api's