C# 无法使用WshShell创建热键为特殊键的快捷方式
我试图将{Num*}分配给快捷方式,但显示错误 “值不在预期范围内” 请帮忙 我的代码:C# 无法使用WshShell创建热键为特殊键的快捷方式,c#,desktop,shortcut,C#,Desktop,Shortcut,我试图将{Num*}分配给快捷方式,但显示错误 “值不在预期范围内” 请帮忙 我的代码: public static string CreateDesktopShortcut(string appPath) { object shDesktop = (object)"Desktop"; WshShell shell = new WshShell(); string shortcutAddress = (s
public static string CreateDesktopShortcut(string appPath)
{
object shDesktop = (object)"Desktop";
WshShell shell = new WshShell();
string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\notepad.lnk";
//delete before creating a new one
if (System.IO.File.Exists(shortcutAddress))
System.IO.File.Delete(shortcutAddress);
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
shortcut.Description = "New shortcut for a Notepad";
shortcut.Hotkey = @"*";
shortcut.TargetPath = appPath + @"\notepad.exe";
shortcut.Save();
return shortcutAddress;
}