Run Command from a Windows Form

  • Thread starter Thread starter Ben Dewey
  • Start date Start date
B

Ben Dewey

I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the Start->Run
Command.

I am have a link in a ListView for "Open Containing Folder", I want to open
the page using windows explorer is there a way to Run("explorer.exe
c:\folder\")?

Also, Is there anyway to focus on an existing window if one is already
created.
 
Ben,

I don't know about focusing on the existing window. For that, you
might have to cycle through the open windows, and maybe query the text of
the windows.

However, in order to open a the containing folder, you would want to use
the Process class, and then pass the name of the directory as the process to
execute. You have to also set UseShellExecute on the ProcessStartInfo
instance to true, I believe.

Hope this helps.
 
I have what I believe is probably a simple question...
Is there any programatic way to launch a program similar to the
Start->Run Command.

I am have a link in a ListView for "Open Containing Folder", I want to
open the page using windows explorer is there a way to
Run("explorer.exe c:\folder\")?

Also, Is there anyway to focus on an existing window if one is
already created.

Don't know about focusing. I doubt that it's built into the framework though.

To start a process have a look at System.Diagnostics.Process.Star
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top