我正在尝试将{Num *}分配给快捷方式,但显示错误 “值不在预期范围内”
请帮助!
我的代码:
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;
}