0
我想建立一个快捷方式,并保存到桌面的公共文件夹,但与此代码抛出UnauthorizedAccessException:UnauthorizedAccessException公共桌面文件夹用C#
WshShell wsh = new WshShell();
IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(
Environment.GetEnvironmentVariable("ALLUSERSDESKTOP") + "\\App.lnk") as IWshRuntimeLibrary.IWshShortcut;
shortcut.Arguments = " some arguments";
shortcut.TargetPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\App\\to\\link\\app.exe";
shortcut.Description = "Description";
shortcut.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\App\\to\\link\\";
shortcut.Save();
这个代码在Windows服务运行,有什么建议? ?
帮助PLZ = S
用户什么是Windows服务运行? –
管理员用户权限,W10 ... – IvanVazquez