我一直在使用下面的代码来动态创建快捷方式。但是当文件夹名称包含 unicode 字符(如泰语、希腊语)时,targetPath 会引发 Argument 异常。
IWshRuntimeLibrary.WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
shortcut.Description = "My shortcut description"; // The description of the shortcut
shortcut.WorkingDirectory = currentPath;
shortcut.TargetPath = targetFileLocation; // The path of the file that will launch when the shortcut is run
shortcut.Save();