BeyondCompare 批处理比较文件并生成报告

核心基本命令:

#C:\Program Files\Beyond Compare 4\BCompare.exe @脚本文件绝对路径 日志文件PATH 比较结果PATH 右文件PATH 左文件PATH
C:\Program Files\Beyond Compare 4\BCompare.exe @G:\bcscript.txt G:\log.txt G:\result.html G:\file1.txt G:\file2.txt

脚本文件例:

log normal %1
criteria rules-based
load <default>

text-report layout:side-by-side options:display-mismatches,ignore-unimportant,line-numbers output-to:"%2" output-options:html-color %3 %4

使用java调用BCompare.exe:

    public static void main(String[] args){
        String[] params = new String[] {"C:\\Program Files\\Beyond Compare 4\\BCompare.exe", 
                "@G:\\CompareTool\\resource\\bcscript.txt",
                "E:\\SVN\\05_ツール転換後ソース\\CreateUrlRequestDTO.ts",
                "E:\\SVN\\01_ソース\\CreateUrlRequestDTO.ts",
                "G:\\CompareTool\\CompareResult\\html\\CreateUrlRequestDTO.html",
                "G:\\CompareTool\\CompareResult\\html\\BCompare_log.txt"
        };
        int returnCD = CompareUtil.run(params);
        if (returnCD != 0) {
            System.err.println("[returnCD]:" + returnCD);
            return;
        }
    }
    public static int run(String ... array){
        try {
            ProcessBuilder builder = new ProcessBuilder();
            builder.command(array);
            Process process = builder.start();
            // Process process = Runtime.getRuntime().exec("C:\\Program Files\\Beyond Compare 4\\BCompare.exe @G:\\CompareTool\\resource\\bcscript.txt");
            InputStream inSTest = process.getErrorStream();
            InputStreamReader reader = new InputStreamReader(inSTest);
            BufferedReader bfReader = new BufferedReader(reader);

            String strLine = "";
            while ((strLine = bfReader.readLine()) != null) {
                System.out.println(strLine);
            }

            bfReader.close();
            process.waitFor();
            process.destroy();

            return process.exitValue();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return - 10000;
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值