Archive: How can I know if [B] Exec "telnet 192.168.20.20" [/B] fails?


How can I know if [B] Exec "telnet 192.168.20.20" [/B] fails?
Hi All,


I have the following line in my .NSI File.

Exec "telnet 192.168.20.20".


I want to know the status of that command, whether it is a success or failure (either after entering Username and password of 192.168.20.20).

If Success,
<Do this>
If Failure
<Do something else>



-Sreedhar


If you use ExecWait, you can get the exit code like so:

ExecWait "telnet 192.168.20.20" $R0

Similarely, with nsExec::Exec...
nsExec::Exec "telnet 192.168.20.20"
Pop $R0

Before you continue, I recommend you call it using command.exe:
ReadEnvStr $R0 "COMSPEC"
nsExec::Exec "$R0 /C telnet 192.168.20.20"
Pop $R0

Some command-line programs only work properly in a simulated DOS environment.

-Stu