C#创建桌面快捷方式 和 开机启动

          /// <summary>
        /// 创建桌面快捷方式 2010-11-25
        /// </summary>
        private static void CreateDesktopShortCut()
        {
            string desktop = Environment .GetFolderPath(Environment. SpecialFolder.Desktop) + "\\广州MES 系统appref-ms";
 
            if (System.IO.File .Exists(desktop))
                return;
            //System.IO.File.Delete(desktop);
 
            //判断路径是否存在
            bool findpath = false ;
 
            string strpath = Environment .GetFolderPath(Environment. SpecialFolder.StartMenu) + "\\程序\\ 北京中软国际信息技术有限公司 \\广州MES 系统appref-ms";
 
            if (System.IO.File .Exists(strpath))
            {
                findpath = true;
            }
            else
            {
                strpath = Environment.GetFolderPath(Environment .SpecialFolder.StartMenu) + "\\Programs\\ 北京中软国际信息技术有限公司 \\广州MES 系统appref-ms";
                if (System.IO.File .Exists(strpath))
                    findpath = true;
            }
 
            if (findpath)
                System.IO. File.Copy(strpath, Environment .GetFolderPath(Environment. SpecialFolder.Desktop) + "\\ 广州MES系统 appref-ms", true );
        }
posted @ 2014-04-07 22:13  晕菜一员  阅读(681)  评论(0编辑  收藏  举报