Launch process (exe file) from resources

谁说我不能喝 提交于 2021-02-17 06:10:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!