Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
755 views
in Technique[技术] by (71.8m points)

nsis - Exec vs ExecWait vs ExecShell vs nsExec::Exec vs nsExec::ExecToLog vs nsExec::ExecToStack vs ExecDos vs ExeCmd

Can I know what are the differences between each Exec, ExecWait, ExecShell, nsExec::Exec, nsExec::ExecToLog, nsExec::ExecToStack, ExecDos and ExecCmd, as in when to use which?

I 've posted the various execute calls I know. I am trying to make a comprehensive list, so that it helps future visitors..

  1. Exec: Plainly execute the called string, be it some application, console or file.

  2. ExecWait: Executes like Exec but waits till the process exits.

  3. ExecShell: What is it for?

  4. nsExec::Exec: Just like Exec or ExecWait but only for command prompt and that too without opening the console window. I am unsure if it waits for process to exit. Does nsExec::Exec wait for child process to exit?

  5. nsExec::ExecToLog: The documentation says ExecToLog is similar to plain nsExec but it outputs to log window. What does that mean, what is a log window?

  6. nsExec::ExecToStack: The documentation says ExecToStack is similar to plain nsExec but it pushes output to stack. I get that.

  7. ExecDos: Same as nsExec::ExecToStack but it additionally (Is it not?)

    a. takes string parameter that serves as stdin for running application.

    b. works in both sync/async mode.

    c. it works out of section - for .onInit check outs.

  8. ExecCmd: Same as ExecDos but it doesn't require these

    ExpandEnvStrings $3 %COMSPEC% 
    ExecDos::exec  /C 
    

    parts. Am I correct?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

1) 2) 3)

Exec and ExecWait use CreateProcess internally and can only start programs and batch files.

ExecShell uses ShellExecute which means that it can also launch any registered filetype (.txt .chm etc) and URLs. It should also be used if the program you are starting needs to elevate with UAC.

4)

nsExec redirects stdout so a console window is not visible when the child process executes. And yes, it waits.

5)

The log window on the instfiles page.

7)

Yes, both ExecDos and ExecCmd are more advanced versions of nsExec.

8)

Correct


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...