nsExec.txt 1.5 KB

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