Archive: How do you ReadINIStr & nsExec::ExecToLog one line with a few parameters?


How do you ReadINIStr & nsExec::ExecToLog one line with a few parameters?
I've tried doing the following which should really be easy but which is proving to be so frustrating. I've tried so many combinations of the following, it got me sick :(

I am trying to read an ini value then feed it into a cmd fired by nsExec::ExecToLog. I've tried so many different combinations, I am tired :( The pasted code below is what I feel should be dead on the money.


ReadEnvStr $0 COMSPEC
ReadINIStr $1 $INSTDIR\madman.ini "field 1" state
nsExec::ExecToLog '$0 /C $\"$INSTDIR\psychopath.exe$\" -r $\"$INSTDIR\hysteria.log$\" /$1 /$1'
When I say I've tried so many things I mean it. Look at the above code... I've tried without exaggeration maybe forty or more different combinations. I finally got tired :(

I just don't see whats going wrong... *sigh*. I'll try to remember a long list of errors and make this quick. Either (A) NSIS wont read it upon install OR (B) It will log the DOS splash screen (MS COPYRIGHT,etc) and nothing else OR (C) It will tell me C:\Program is not a program, etc OR (D) I can only get the first of the code to work

nsExec::ExecToLog '$0 /C $\"$INSTDIR\psychopath.exe$\"


The entire line of code above (-minus NSIS format) direct into the cmdline works perfect without hiccup. Yet I must be getting the format horribly wrong. Can someone please help shine some light on my problem?

Thank you for your time!

ReadINIStr $1 "$INSTDIR\madman.ini" "field 1" "state"

INSTDIR includes blank spaces, this is why c:\program is not a program. ;)
MessageBox also helps to debug (after every statement :) )
Are you really sure you need this cmd line beginning?
"E:\WINNT\system32\cmd.exe /C ..."
nsExec works without this.


Thank you for pointing that out. I am not sure why I've been using comspec but remember faintly it being because it was supposed to be a sure fire way to find the cmd :)

After 3 hours of sleep and my baby waking me up, I checked this thread, got back to work on it and got it to work. I removed code like you suggested and all seems well.

Thank you for your help and time Takhir!