Old 29th October 2003, 00:36   #1
n6mod
Junior Member
 
Join Date: Oct 2003
Posts: 7
Exec and command line redirects?

OK, I've been fighting this one all afternoon.

I need to execute the command line

mkpasswd -l >> passwd

mkpasswd lives in $INSTDIR\bin, and I really want the file to land in $INSTDIR\etc, but I can't even get that far. mkpasswd just prints to stdout and I need to get that into a file.

No matter what combination of quoting (and I've tried a lot) I use, I always get either silent failure or "mkpasswd: a domain is only accepted when -d is given"

In other words, the '>>' is being interpreted as a parameter to mkpasswd, not as a redirect.

I've read a dozen threads on similar and I can't figure this one out.

I really want to say

nsExec::ExecToLog '$INSTDIR\bin\mkpasswd -l >> $INSTDIR\etc\passwd'

with whatever additional quoting/escaping/chanting/cursing is necessary to make it work.

Any guidance would be appreciated.

Thanks,
Zandr
n6mod is offline   Reply With Quote
Old 29th October 2003, 12:51   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You must use the command line interpreter to use redirection. Use petersa's method in this thread:

http://forums.winamp.com/showthread....ighlight=mysql

Don't forget to use short file names for the command line interpreter. Use GetFullPathName /SHORT if the path is dynamic (includes $INSTDIR like in your case, for example).

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 29th October 2003, 16:43   #3
n6mod
Junior Member
 
Join Date: Oct 2003
Posts: 7
Thanks kichik!

I ended up working around this last night by invoking .bat files, but this is easier to maintain.

Thanks again,
Z
n6mod is offline   Reply With Quote
Old 14th April 2006, 18:37   #4
PatPowerMan
Guest
 
Posts: n/a
Could someone post a WORKING solution for exactly that?
I can't figure out, how the command
mkpasswd -l >> passwd
should work from NSIS and write the 'passwd' to the standard-etc-directory.
  Reply With Quote
Old 14th April 2006, 20:30   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
code:
ReadEnvStr $0 COMSPEC
ExecWait "$0 /c mkpasswd -l >> passwd"


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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