C# 通过程序执行svn更新或提交更改

实现方法:
        private static void RunBat(string program, string parm)
        {
            try
            {
                Process proc = new Process();
                proc.StartInfo.FileName = program;
                proc.StartInfo.Arguments = string.Format(parm);//this is argument
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.CreateNoWindow = true;
                proc.Start();
                proc.WaitForExit();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
            }
        }

//svn update:
            RunBat("TortoiseProc", string.Format($"/command:update /path:{"更新的路径(绝对路径|相对路径都可)"} /closeonend:3"));
//svn commit
            RunBat("TortoiseProc", string.Format($"/command:commit /path:{"更新的路径(绝对路径|相对路径都可)"} /closeonend:3"));

 

上一篇:如何使用 Process 类执行程序,打开文件/文件夹/http地址


下一篇:C# 调用cmd.exe命令行命令 net use