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