如何仅在进程开始位置显示快捷方式文件(.lnk)? [英] how to show up the shortcut file (.lnk) only in process start location?
本文介绍了如何仅在进程开始位置显示快捷方式文件(.lnk)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void button1_Click(object sender, EventArgs e)
{
String path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs", "*.lnk";
Process.Start (path);
}
推荐答案
不完全确定你想要做什么,但是如果你想过滤掉具有特定扩展名的文件在目录中,您应该使用 Directory.GetFiles [ ^ ]
这样的东西,但我认为没有人会对这样的功能感到满意。 :-P
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
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);
}
}
这篇关于如何仅在进程开始位置显示快捷方式文件(.lnk)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文