Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I use System.Diagnostics.Process.Start(foldername) to open a folder in c#.

How can I select a file in that folder with c# code when the directory was opened?
Eg. Internet download manager that when you click on open folder that open directtory and automatically select your downloaded file, how can I do that?
Posted
Updated 14-Aug-11 23:02pm
v2
Comments
Dalek Dave 15-Aug-11 5:02am    
Edited for Grammar and Readability.
Sergey Alexandrovich Kryukov 15-Aug-11 22:56pm    
There is no a concept "open directory"; there is only a UI metaphor similar to that; there is no "select" -- same thing. As you don't discuss UI, what sense it might make?
--SA

 
Share this answer
 
Comments
Dalek Dave 15-Aug-11 5:02am    
Good Link.
If I understand you correctly you want to achieve something like Visual Studios 'Open containing folder' feature. I usually do that by using explorers /select option.

C#
Process.Start("explorer.exe", string.Format("/select,\"{0}\"", <filename>));


see also http://support.microsoft.com/kb/314853[^] for more information about the select option of explorer.
 
Share this answer
 
v2
Comments
a.bolandnataj106 28-Aug-11 0:24am    
Thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900