Process.Start() problem / slowness

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

In my app I have a download folder and I try to open it with this code:
ProcessStartInfo psi = new ProcessStartInfo(OutputDir);
psi.UseShellExecute = true;
Process.Start(psi);

However it takes about 5 seconds to execute!!
Any idea why?
 
Do you need to open Windows Explorer, or will the Command prompt do? If so,

ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");
psi.WorkingDirectory = "c:\\";
psi.UseShellExecute = false;
Process.Start(psi);
 
I do need to open in the explorer, so the user could double-click on the
files (to 'execute them') if he wants.
And the folder seems to display allright when I navigate to it with the File
Explorer....
(I mean no weird latency)

For the record the folder is:
C:\Documents and Settings\Lloyd Dupont\Local Settings\Application
Data\NovaMind Software\NovaMindViewer\1.0.0.0
AKA
Application.LocalUserAppDataPath
 
I think that has more to do with your hard drive than .NET.
It might be simply slow or fragmented. Also, I am guessing a program in
debug mode might take a little longer to execute such a request, I might
be wrong.
 
Hmm, not quite sure what to think. On my setup the code executes as fast as
opening Windows Explorer manually. What happens if you have only this code
in a sample project/solution, will it execute any faster? What I am getting
at, is if you have any other code that would slow this down.
 
I speed it up!
I didn't use Shell execute but uses this code instead:
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "explorer.exe";
psi.Arguments = string.Format("\"{0}\"", OutputDir);
psi.UseShellExecute = false;
Process.Start(psi);

In my app I have a download folder and I try to open it with this code:
ProcessStartInfo psi = new ProcessStartInfo(OutputDir);
psi.UseShellExecute = true;
Process.Start(psi);

However it takes about 5 seconds to execute!!
Any idea why?
 
Back
Top