starfighter5
15th December 2010 14:25 UTC
Running a command line option - ExecDos?
I am trying to run a command to zip up certain files after an installation. I have included 7zip into the install folder and am now looking for a way to run the command.....
7za a -tzip tester.zip
I have been looking at using ExecDos::exec but haven't had any luck. I tried the command...
ExecDos::exec /TOFUNC '"7za a -tzip tester.zip"'
But it isn't working for me, is there an easier way to do it or am I on the right tracks with ExecDos?
MSG
15th December 2010 14:49 UTC
Why not just call it using ExecWait or nsExec::Exec?
starfighter5
15th December 2010 15:01 UTC
I have tried using...
ExecWait '"7za a -tzip tester.zip tester.txt"'
This still doesn't appear to run the command, or at least the zip file isn't created. If I run that command from the command prompt the zip is created so I'm sure the command is ok..
MSG
15th December 2010 15:20 UTC
You need to give ExecWait a proper path.
starfighter5
15th December 2010 15:41 UTC
Ok I have changed the line to....
ExecWait '""$INSTDIR\7za a -tzip $INSTDIR\tester.zip $INSTDIR\tester.txt'
Looking at the output from the installer it executes the command which reads
Execute: "C:\testfolder\7za a -tzip c:\testfolder\tester.zip c:\testfolder\tester.txt"
The zip file still doesn't get created :(
jpderuiter
15th December 2010 17:03 UTC
Try
ExecWait '"$INSTDIR\7za.exe" a -tzip "$INSTDIR\tester.zip" "$INSTDIR\tester.txt"'
Takhir
15th December 2010 18:43 UTC
This work fine for me
ExecDos::exec '"C:\Program Files\7-Zip\7z.exe" a -tzip "$EXEDIR\tester.zip" "C:\Program Files\7-Zip\Lang"' "" "$EXEDIR\stdout.txt"
Pop $0 ;
Afrow UK
15th December 2010 22:35 UTC
You had your quotes wrong. The quotes go around the file path only.
Stu
starfighter5
17th December 2010 11:02 UTC
Thanks, all working now :)