This is my code:
${If} ${Silent}
${GetOptions} $CMDLINE "/F " $R1
ReadINIStr $1 $R1 "xxxx" "host"
ReadINIStr $2 $R1 "xxxx" "port"
${EndIf}
ps : $R1 is a ".ini" file, this only a example.
Problem:
1.When user install the old version installer, how i display error information. ex:"You have install a newest product, the install will exit now." Because i can't use the MessageBox to show the information in the silent install, i must use a return value in the cmdline... How to resolve this problem?
About $CMDLINE in silent install
10 posts
You cannot return things "in the cmdline". Are you talking about writing to stdout?
what?? I want to return a error value and information in the cmdline when i install old version installer, but silent install cat't use messagebox to show this, how can i return in the cmdline
cat't is can't
You can use MessageBox in a silent installer if you want to.Originally Posted by yzldni View PostI want to return a error value and information in the cmdline when i install old version installer, but silent install cat't use messagebox to show this, how can i return in the cmdline
You cannot return "in the cmdline" because that statement does not make any sense. The command line is a string with the parameters the user entered when starting the installer (Ex: Setup.exe /foo /bar).
If you want to write a string to the Console (a.k.a DOS box a.k.a Terminal a.k.a stdout) then you need to say so...
System::Call 'kernel32::GetStdHandle(i -11)i.r0'it is show C:\user\administrator\hello
System::Call 'kernel32::AttachConsole(i -1)'
FileWrite $0 "hello"
and not show C:\user\administrator\
hello
and it will keep staying, not ending after show "hello" why ????
NSIS is a GUI application and writing to stdout like that is a hack. cmd.exe cannot handle this and that's why it ends up like that, there is nothing you can do about it.
Why? cmd.exe sees that it is a GUI application and does not wait, it just prints the current directory right away. Then your setup attaches to the console and starts printing. You now how two processes writing to stdout at the same time and you get timing issues etc.
Why? cmd.exe sees that it is a GUI application and does not wait, it just prints the current directory right away. Then your setup attaches to the console and starts printing. You now how two processes writing to stdout at the same time and you get timing issues etc.
do you have some way to show
C:\user\administrator\
hello
and not show C:\user\administrator\hello
C:\user\administrator\
hello
and not show C:\user\administrator\hello
I already told you, there are timing issues here and you don't know exactly when cmd.exe is going to print its line. The best thing you can do is add a newline ($\r$\n) yourself. Even if you do this the state of cmd.exe is going to be weird, you just have to accept that it will never work 100% correctly...