winrar a 压缩包保存的绝对路径 要压缩的文件的路径
winrar a -hp密码 压缩包保存的绝对路径 要压缩的文件的路径
如果不添加环境变量,这个命令要在winrar的安装目录运行。
String path = "d:/视频下载/";
ArrayList<StringBuffer> list = FilePath.readFileListPath(path);
FilePath filePath = null;
StringBuffer oldPath = null;
StringBuffer newPath = null;
StringBuffer command = null;
for (int i = 0;i < list.size();++i)
{
filePath = new FilePath(list.get(i));
oldPath = filePath.getPath();
filePath.changeFileName(Conver.nsb(i + 1));
filePath.changeSuffixName(Conver.nsb(".rar"));
newPath = filePath.getPath();
command = SubStr.concat(Conver.nsb("rar a "), newPath, Conver.nsb(" "), oldPath);
System.out.println(command);
WinSystem.cmd(command.toString(), "GBK")
}
System.out.println("全部完成");