Shell32.Shell shell = new ShellClass();
Folder folder = shell.NameSpace(@"C:\Windows\") as Folder;
FolderItem folderItem = folder.ParseName("regedit.exe");
FolderItemVerbs vs = folderItem.Verbs();
for (int i = 0; i < vs.Count; i++)
{
FolderItemVerb ib = vs.Item(i);
if (ib.Name.Replace("&", "") == "Pin to Taskbar")
{
Console.WriteLine(ib.Name);
ib.DoIt();
}
}
yeah! right click on .exe and just execute the right menu! resouce name can be found in shell32 or something else.
COM name is Microsoft Shell and Application 1.0
原文在这里, 是可以拿C#做的, 不必非要运行一个脚本。
http://blog.ananthonline.net/?p=37