| 1 |
nsExec |
| 2 |
------ |
| 3 |
nsExec will execute command-line based programs and capture the output |
| 4 |
without opening a dos box. |
| 5 |
|
| 6 |
|
| 7 |
Usage |
| 8 |
----- |
| 9 |
nsExec::Exec [/MBCS] [/OEM] [/TIMEOUT=x] path |
| 10 |
Pop $0 |
| 11 |
|
| 12 |
-or- |
| 13 |
|
| 14 |
nsExec::ExecToLog [/MBCS] [/OEM] [/TIMEOUT=x] path |
| 15 |
Pop $0 |
| 16 |
|
| 17 |
-or- |
| 18 |
|
| 19 |
nsExec::ExecToStack [/MBCS] [/OEM] [/TIMEOUT=x] path |
| 20 |
Pop $0 ; Return |
| 21 |
Pop $1 ; Output |
| 22 |
|
| 23 |
All functions are the same except ExecToLog will print the output |
| 24 |
to the log window and ExecToStack will push up to ${NSIS_MAX_STRLEN} |
| 25 |
characters of output onto the stack after the return value. |
| 26 |
|
| 27 |
Use the /MBCS switch to disable Unicode detection and always treat the text as ANSI. |
| 28 |
|
| 29 |
Use the /OEM switch to convert the output text from OEM to ANSI. |
| 30 |
|
| 31 |
The timeout value is optional. The timeout is the time in |
| 32 |
milliseconds nsExec will wait for output. If output from the |
| 33 |
process is received, the timeout value is reset and it will |
| 34 |
again wait for more output using the timeout value. See Return |
| 35 |
Value for how to check if there was a timeout. |
| 36 |
|
| 37 |
To ensure that command are executed without problems on all windows versions, |
| 38 |
is recommended to use the following syntax: |
| 39 |
|
| 40 |
nsExec::ExecToStack [OPTIONS] '"PATH" param1 param2 paramN' |
| 41 |
|
| 42 |
This way the application path may contain non 8.3 paths (with spaces) |
| 43 |
|
| 44 |
Return Value |
| 45 |
------------ |
| 46 |
If nsExec is unable to execute the process, it will return "error" |
| 47 |
on the top of the stack, if the process timed out it will return |
| 48 |
"timeout", else it will return the return code from the |
| 49 |
executed process. |
| 50 |
|
| 51 |
|
| 52 |
Copyright Info |
| 53 |
-------------- |
| 54 |
Copyright (c) 2002 Robert Rainwater |
| 55 |
Thanks to Justin Frankel and Amir Szekely |