![]() |
#1 |
Junior Member
Join Date: Oct 2002
Location: Canada
Posts: 5
|
ExecWait with file redirection
Hi,
Trying to use ExecWait (NSIS2, ModernUI) in a section to redirect external program output to file: SetOutPath $INSTDIR File "memory.exe" ExecWait '"$INSTDIR\memory.exe" > "$INSTDIR\memory.txt"' $0 IfErrors e1 e2 e1: MessageBox MB_OK "Error = $0" goto e3 e2: MessageBox MB_OK "OK" e3: ExecWait returns no error, yet file is not created. Any ideas? Thanks. |
![]() |
![]() |
![]() |
#2 |
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
This thread should help you:
http://forums.winamp.com/showthread....ighlight=mysql BTW, you might also want to try out nsExec, maybe it can help you too. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Oct 2002
Location: Canada
Posts: 5
|
Thanks for the link Kichik.
Here is the the code that worked for me: ExpandEnvStrings $1 %COMSPEC% ExecWait '"$1" /C "$INSTDIR\memory.exe" > "$INSTDIR\mem.txt"' $0 |
![]() |
![]() |
![]() |
#4 |
Member
Join Date: Jan 2003
Posts: 78
|
![]()
Hi,
I guess I have a some-what similar problem. I am trying to pipe my output to a log file and I have attempt the below 3 options but none of them creates the test.log file. Could someone please help. Thanks. ExecWait 'call "$INSTDIR\test.bat" "2> $INSTDIR\test.log"' $0 ExecWait 'call "$INSTDIR\test.bat" 2> "$INSTDIR\test.log"' $0 ExecWait "call $INSTDIR\test.bat 2> $INSTDIR\test.log" $0 ![]() |
![]() |
![]() |
![]() |
#5 |
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Use the code above:
ExpandEnvStrings $1 %COMSPEC% ExecWait '"$1" /C "$INSTDIR\test.bat" > "$INSTDIR\test.log"' $0 NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
![]() |
![]() |
![]() |
#6 | |
Junior Member
Join Date: Jun 2009
Posts: 1
|
Quote:
After about try 1038 I decided to try taking the quotes out. It started working. strcpy $BACKUPFILE "$TEMP\ADMIN_DB_MYSQL_BACKUP.sql" strcpy $BACKUPFILE_PREPARED "$TEMP\ADMIN_DB_MYSQL_BACKUP_PREPARED.sql" strcpy $1 $BACKUPFILE ExpandEnvStrings $2 %COMSPEC% Before: ExecWait '"$2" /C "$INSTDIR\bin\mysqldump.exe" --quick --add-drop-table --extended-insert --force --user=username --password=password database > "$1"' $0 After: ExecWait '"$2" /C "$INSTDIR\bin\mysqldump.exe" --quick --add-drop-table --extended-insert --force --user=username --password=password database > $1' $0 The reason I resorted to $1 instead of $BACKUPFILE was that I thought variable expansion wasn't working correctly, so sorry for the unnecessary confusion. Any reason why the first attempt didn't work? Thanks! Brandon |
|
![]() |
![]() |
![]() |
#7 |
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
cmd.exe sucks, though probably for a reason. Add a IF 1==1 prefix to your command.
code: NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|