问题
I have a compiled exe file which I use to convert images. It is named convert.exe. I want to use it within my C# application without being visible in my application folder. So I thought I could add it as a resource. The problem is: How can I launch an external process of an exe file stored in my resources?
回答1:
Unfortunately, there is no way around what Hans Passant said. Practically, in order to run it you must first save it to disk. There are several applications that use this method. One of them is SysInternals Process Explorer. It used to contain the 64 version of the EXE in a resource (I am not 100% sure they still do it this way in the latest version). In any case there are several examples and tutorials on the web for this. Here is one.
回答2:
If you implement some kind of web server in your program (leveraging http.sys), you can run the executable from a unc path that resolves (via windwows webdav client) to the url.
来源:https://stackoverflow.com/questions/9647534/launch-process-exe-file-from-resources