C# 导入.reg文件

 /// <summary>
        /// 执行注册表导入
         /// </summary>
        /// <param name="regPath">注册表文件路径</param>
        public void ExecuteReg(string regPath)
        {
            if (File.Exists(regPath))
            {
                regPath = @"""" + regPath + @"""";
                Process.Start("regedit", string.Format(" /s {0}",regPath));
            }
        }

 

如果注册表路径含有空格,则需要使用双引号引起来,不然会报错。

/s:指示不弹出导入注册表对话框

posted on 2014-05-16 21:14  IOTer  阅读(1028)  评论(0编辑  收藏  举报

导航