Juan Angel Arias
Juan Angel Arias

Reputation: 5

Open the Explorer Process in c#

I'm currently having a issue i need to create a App that open the Explorer.exe Process after the Credentials are Correct.

What i decided to do was the Following after it searched the DB and the info is correct.

        Process process = new Process();
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        startInfo.FileName = "cmd.exe";
        startInfo.Arguments = "explorer.exe";
        process.StartInfo = startInfo;
        process.Start();

After the App Opens the CMD but does not start the Explorer Function.

What am i doing Wrong or is there another Way .

Thanks

Upvotes: 0

Views: 1632

Answers (1)

BradleyDotNET
BradleyDotNET

Reputation: 61349

I'm not sure why you would try to open Windows Explorer from a new command line process, just start Explorer directly:

Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = false; //I don't need it, but the OP did.
startInfo.FileName = "explorer.exe";
startInfo.Arguments = "";
process.StartInfo = startInfo;
process.Start();

Verified working on .NET 4.5, Windows 7

Upvotes: 4

Related Questions