1 月
16
16
C# 呼叫執行 WinRar
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
namespace BatchRar {
class Program {
static void Main(string[] args) {
String path = “d:\cvs\”;
DirectoryInfo di = new DirectoryInfo( path);
foreach (DirectoryInfo d in di.GetDirectories()) {
//WinRAR.exe a -r -m0 -v1G c:\bak.rar c:\dat\
String cmd = String.Format(” a “{1}{2}.rar” “{0}””, d.FullName, path, d.Name);
Process proc = new Process();
proc.StartInfo = new ProcessStartInfo(“winrar.exe“, cmd);
proc.Start();
proc.WaitForExit();
}
}
}
}
There are no comments.