Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Run Exe file as an Embedded Resource in C# on selected folder

$
0
0

How can i launch a embedded exe in selected folder in c# visual studio 2013?


i used this code

  {
            byte[] exeBytes = Properties.Resources.OPKMR;
            string exeToRun = @"C:\TEST\MyTestExe.exe";

            using (FileStream exeFile = new FileStream(exeToRun, FileMode.CreateNew))
            {
                exeFile.Write(exeBytes, 0, exeBytes.Length);
            }

            using (Process exeProcess = Process.Start(exeToRun))
            {
                exeProcess.WaitForExit();
            }

but when i click launch it says:

System.IO.DirectoryNotFoundException in mscorlib.dll

can't find 'C:\TEST\MyTestExe.exe'.

I want the .exe in resources launches from selected folder

Sorry for my english


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>