471,354 Members | 1,199 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Run Command from a Windows Form

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.
Feb 7 '06 #1
2 4456
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ben Dewey" <As*********@hotmail.com> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
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.

Feb 7 '06 #2
> 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.Start
Feb 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jarod | last post: by
reply views Thread by January Smith | last post: by
3 posts views Thread by Tomas Andersson | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.