Click here to Skip to main content
15,917,059 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
private void button1_Click(object sender, EventArgs e)
{
    String path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs", "*.lnk";
    Process.Start (path);    
}
Posted
Updated 19-Nov-15 17:09pm
v2
Comments
Nigol_Learner 19-Nov-15 20:49pm    
Maybe won't work but if have any idea plz share, Thank you Guys.
Sergey Alexandrovich Kryukov 19-Nov-15 23:05pm    
Please, what is that "show" supposed to mean?
—SA
George Jonsson 19-Nov-15 23:11pm    
The code you show won't even compile.
You should explain more what it is you want to do and then someone can help you.
The information you have provided is not enough.
Nigol_Learner 20-Nov-15 3:49am    
It won't compile because there is error at "*.lnk". What I want is, when process start the specific directory, in that directory only able to see shortcut file. So how to do that?
@"C:\ProgramData\Microsoft\Windows\Start Menu\Programs", "*.lnk";

1 solution

Not exactly sure what you want to do, but if you want to filter out files with a specific extension in a directory you should use Directory.GetFiles[^]

Something like this, but I don't think anyone would be happy with a functionality like this. :-P
C#
private void button1_Click(object sender, EventArgs e)
{
    string path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs";
    foreach (string fileName in Directory.GetFiles(path, "*.lnk"))
    {
        Process.Start(fileName);
    }
}
 
Share this answer
 
Comments
Nigol_Learner 22-Nov-15 20:29pm    
But I Like it bro,,,,thanks,,,,i get what I want.....
George Jonsson 22-Nov-15 20:41pm    
Then it is all good.

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