复制快捷方式到桌面就可以,复制到开始,程序就不行,是不是系统有保护呀,要怎么作呀?哪位高手指点一下呀?
string pathDeskTop = "C:" + "\\" + "Documents and Settings" + "\\" + "All Users" + "\\" + "桌面" + "\\" + "IT部门管理系统.lnk";
string pathProgram = "Environment.GetFolderPath(Environment.SpecialFolder.Programs)" + "\\";
// string pathProgram = "C:" + "\\" + "Documents and Settings" + "\\" + "All Users" + "\\" + " 「开始」菜单" + "\\" + "程序" + "\\" + "ITSys" + "\\";
CopyDirectory(Application.StartupPath + "\\", txtDSPath.Text);
//shortcut(_path);
System.IO.File.Copy(Application.StartupPath + "\\" + "IT部门管理系统.lnk", pathDeskTop, true);
System.IO.File.Copy(Application.StartupPath + "\\" + "IT部门管理系统.lnk", pathProgram, true);
System.IO.File.Copy(Application.StartupPath + "\\" + "卸载.lnk", pathProgram, true);
string pathDeskTop = "C:" + "\\" + "Documents and Settings" + "\\" + "All Users" + "\\" + "桌面" + "\\" + "IT部门管理系统.lnk";
string pathProgram = "Environment.GetFolderPath(Environment.SpecialFolder.Programs)" + "\\";
// string pathProgram = "C:" + "\\" + "Documents and Settings" + "\\" + "All Users" + "\\" + " 「开始」菜单" + "\\" + "程序" + "\\" + "ITSys" + "\\";
CopyDirectory(Application.StartupPath + "\\", txtDSPath.Text);
//shortcut(_path);
System.IO.File.Copy(Application.StartupPath + "\\" + "IT部门管理系统.lnk", pathDeskTop, true);
System.IO.File.Copy(Application.StartupPath + "\\" + "IT部门管理系统.lnk", pathProgram, true);
System.IO.File.Copy(Application.StartupPath + "\\" + "卸载.lnk", pathProgram, true);
string shortcutPath = "";
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);
shortcut.TargetPath = Application.ExecutablePath;
shortcut.WorkingDirectory = System.Environment.CurrentDirectory;
shortcut.WindowStyle = 1;
shortcut.Description = "";
shortcut.IconLocation = Application.ExecutablePath + ",0";
shortcut.Save();
开始那块有空格造成的。看来要想办法去掉它