static void Convert(string resourcesFilePath) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe "; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; //p.StartInfo.CreateNoWindow = false; p.Start(); //+ ‘"‘ + ‘"‘ + can replace p.StandardInput.WriteLine("%comspec% /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\Common7\\Tools\\VsDevCmd.bat\""); Console.WriteLine(resourcesFilePath); p.StandardInput.WriteLine(" resgen " + resourcesFilePath + " " + resourcesFilePath.Replace(".resources", ".resx")); p.StandardInput.WriteLine(" "); p.StandardInput.Flush(); p.StandardInput.WriteLine(" exit "); //Exit cmd.exe p.StandardInput.WriteLine(" exit "); p.WaitForExit(); var s = p.StandardOutput.ReadToEnd(); Console.WriteLine("s_________________________________________________SSSSSSSSSSSSSSSSSSSSSSSSSS"); Console.WriteLine(s); p.Close(); }