目前我执行以下操作:
以下是我使用的代码:
byte[] exeFile =ExeSecure.Properties.Resources.ReqCheck;
//2) Create file to be deleted on close
FileStream aFile = new FileStream(@"c:\reco.exe", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 20000, FileOptions.DeleteOnClose);
//3) Write Exe file content to HDD
aFile.Write(exeFile, 0, exeFile.Length);
aFile.Flush();
Thread.Sleep(100); //Wait a while for file to be flushed
while (!File.Exists(@"c:\reco.exe")); //Make sure file is there on HDD
Process.Start("C:\reco.exe");//Start file , this always fails.
答案 0 :(得分:2)
也许这只是您问题中的拼写错误,但Process.Start
中的路径不正确。您错过了@
标志:
Process.Start(@"C:\reco.exe");