Beyond Compare脚本:命令行批量比较文件并生成html格式的差异报告

BComp.exe /silent /closescript /solo
@E:\compareTest\BCbatch.txt

text-report layout:side-by-side
options:display-all,line-numbers title:"report"
output-to:"E:\compareTest\report.htm" output-options:wrap-word,html-color
"E:\Edit1" "E:\Edit2"

http://html5.codemach.com/beyondcompare-jiao-ben-bi-jiao-wen-jian-bing-sheng-cheng-html-ge-shi-de-cha-yi-bao-gao.html

说明:以下内容在Windows环境下验证OK

1、将Beyond Compare的安装路径添加到环境变量,以便在命令行中运行BCompare.exe命令

2、新建一个文本文件diff_to_html.txt,输入并保存以下内容:

text-report layout:side-by-side &
 
options:ignore-unimportant,display-context &
  output-to:%3
output-options:html-color %1 %2

3、在命令行中,运行以下命令:

> BCompare.exe /silent @diff_to_html.txt my_file.txt your_file.txt
my_report.html

注意:这里假设*.txt、*.html都在当前工作目录中;其他情况下,请在文件名前加上相应的路径前缀Beyond
Compare脚本:比较文件并生成html格式的差异报告

--------------------------------------------------------------------------------------------------------------------------------------------------

新建一个文本文件,假设命名为BCbatch.txt,只有一行内容如下:

file-report layout:side-by-side options:display-all,line-numbers
output-to:"report.htm" output-options:wrap-word,html-color "比较文件1的全路径"
"比较文件2的全路径"

然后在命令行下执行:

BC.exe @BCbatch.txt

http://www.scootersoftware.com/help/index.html?command_line_reference.html






Command Line
Reference





Command Line
Parameters

Notice that each parameter should be enclosed in quotation marks if it
might contain a space.

 Note  Linux users should use
"bcompare" instead of "BCompare.exe".






























Parameter

Meaning

Named Session

Opens the specified session in the
appropriate view.  For example:

BCompare.exe "My
Session"

Named Workspace

Opens the specified saved workspace. 
(see also Managing
Workspaces
)  For example:

BCompare.exe "My
Special Workspace"

Pair of folders

Opens a new Folder Compare view with the
specified base folders.  For example:

BCompare.exe "C:\Left
Folder" "C:\Right
Folder"

Pair of files

Opens the specified files in the
associated file view.  For example:

BCompare.exe "C:\Left
File.ext" "C:\Right File.ext"

3 files 

Opens a Text Merge view with the specified
files in the left, right, and center panes.  For example:

BCompare.exe C:\Left.ext C:\Right.ext
C:\Center.ext

4 files 

Opens a Text Merge view with the specified
files in the left, right, center, and output panes.  For
example:

BCompare.exe C:\Left.ext C:\Right.ext
C:\Center.ext
C:\Output.ext

Script file

Automatically executes a list of commands
without using a view.  For example:

BCompare.exe "@C:\My
Script.txt"

-

Opens stdin in the appropriate view. 
For example:

dir |
BCompare.exe -

Command Line
Switches

 Note  Linux users should prefix
the switches with "-" instead of "/".











































































Switch

Meaning

/?

Displays the command line
documentation.

/automerge 

Automatically merges files without user
interaction unless conflicts are found.

/bds <filename>

Prompts to compare against previous
revisions available in the CodeGear RAD Studio/Borland Developer
Studio "__history" folders.  Add to the IDE Tools menu with
"/BDS $SAVE $EDNAME" as the parameters, or use the Beyond Compare
IDE Expert from JED Software, available at www.jed-software.com.

/closescript

Closes the script window on
completion.  Overrides the Close
when finished setting in Tools > Options > Scripts.

/edit

Opens a Text Edit view.

/expandall

Expands all subfolders during the initial
folder comparison.

/favorleft

/favorright 

Draws non-conflicting changes in the
output from the "favored" side without coloring or section
lines.  For ignored unimportant conflicts, changes are
automatically taken from the "favored" side instead of the
center.

/filters=<file
masks>

Uses the specified name filter for the
initial folder comparison.  Separate multiple file
masks
 with semi-colons.  Surround the name filter with
quotes if it contains spaces.

/force 

Writes conflicts to the output with
CVS-style markers if/automerge is present.

/fv=<type>, /fileviewer=<type>

Opens a new view of the specified type
which can be any of:

"Text Compare"

"Text Merge"

"Data Compare"

"Hex Compare"

"MP3 Compare"

"Picture Compare"

"Registry Compare"

"Version Compare"

/iu, /ignoreunimportant

Turns on Ignore Unimportant
Differences if /automerge is present.

/mergeoutput=<filename> 

Explicitly specifies the merge output
file.

/nobackups

Prevents the creation of backup files.

/qc=<type>, /quickcompare=<type>

Performs a quick comparison of two files
and sets the DOS error level on exit.  The specified type can
be size, crc,
or binary.  If a type
is not specified, a rules-based comparison will be performed. 
Error levels are documented below.

/reviewconflicts 

Opens a Text Merge view if /automerge is present and
conflicts are found.

/ro, /readonly

Disables editing on all sides.

/ro1, /lro, /leftreadonly

/ro2, /rro,
/rightreadonly

Disables editing on the respective
side.

/savetarget=<filename>

Overwrites the specified file instead of
original file when the file view‘s Save command is used.

/silent

Causes a script to be processed invisibly,
bypassing the Task Bar entry and Scripting Status window.  All
interaction will be suppressed, so any unresolved issue that would
normally show a dialog will log an error instead.

/solo

Forces a new instance of the program.

/sync

Opens a Folder Sync view.

/title1=<title>, /lefttitle=<title>

/title2=<title>, /righttitle=<title>

/title3=<title>, /centertitle=<title>

/title4=<title>, /outputtitle=<title>

Shows the specified description in the
respective path edit.

/vcs1=<path>, /vcsleft=<path>

/vcs2=<path>, /vcsright=<path>

/vcs3=<path>, /vcscenter=<path>

/vcs4=<path>, /vcsoutput=<path>

Shows the specified version control system
path in the respective path edit unless a title has been
provided.  For a file view, the specified path is also used to
pick the appropriate file format.

DOS Error Levels set on
exit



















































Level

Meaning

0

Success

1

Binary same

2

Rules-based same

11

Binary differences

12

Similar

13

Rules-based differences

14

Conflicts detected

100

Unknown error

101

Conflicts detected, merge output not
written

102

BComp.exe unable to wait until
BCompare.exe finishes

103

BComp.exe cannot find BCompare.exe

104

Trial period expired

105

Error loading script file

106

Script syntax error

107

Script failed to load folders or files

Command
Line Executable Files 














Executable

Meaning

BCompare.exe

This is the main application.  Only
one copy will run at a time, regardless of how many windows you have
open.  If you launch a second copy it will tell the existing
copy to start a comparison and exit immediately.

BComp.exe

This is a Win32 GUI program.  If launched from a version
control system, it should work just fine.  If launched from a
console window, the console (or batch file) will not wait for
it.

BComp.com

This is a Win32 console program.  It has to have a
console.  If you launch it from one (or a batch file) that
console will wait for the comparison to complete before
returning.  If you launch it from a version control system
interactively, it will show a console window while it‘s waiting.


时间: 2024-10-15 04:21:09

Beyond Compare脚本:命令行批量比较文件并生成html格式的差异报告的相关文章

Linux命令行批量替换多文件中的字符串【转】

Linux命令行批量替换多文件中的字符串[转自百度文库] 一种是Mahuinan法,一种是Sumly法,一种是30T法分别如下: 一.Mahuinan法: 用sed命令可以批量替换多个文件中的字符串.sed -i "s/原字符串/新字符串/g" `grep 原字符串 -rl 所在目录` 例如:我要把mahuinan替换为huinanma, 执行命令:sed -i "s/mahuinan/huinanma/g" 'grep mahuinan -rl /www' 这是目

如何优雅地使用命令行设置windows文件关联

如何优雅地使用命令行设置windows文件关联 使用ftype查看帮助 设置关联所需命令有ftype assoc,需要管理员权限.如果忘记使用方法可通过ftype的帮助获取查看方法 C:\WINDOWS\system32>ftype /? 显示或修改用在文件扩展名关联中的文件类型 FTYPE [fileType[=[openCommandString]]] fileType 指定要检查或改变的文件类型 openCommandString 指定调用这类文件时要使用的开放式命令. 键入 FTYPE

Linux服务器通过aws命令行上传文件至S3

目的Linux服务器通过AWS命令行上传文件至S3 配置打开你的AWS控制台: 连接你的Linux服务器,按照以下步骤操作: # 安装pip yum -y install python-pip   # 安装awscli pip install awscli   # 初始化配置 aws configure # 做这一步时系统会要求你输入"访问密钥ID"."私有访问密钥"."默认区域名称"."默认输出格式",前两个在创建IAM用户

Cmd命令行编译c#文件

使用命令行编译C#文件的方法: 首先,在系统变量的Path变量中添加csc.exe文件路径 路径大概是这个样子:C:\Windows\Microsoft.NET\Framework64\v4.0.30319;  (.net版本也许不同) 在cmd中输入csc.exe验证是否成功. cs文件生成exe文件:(若要编译生成EXE文件则源文件中需包含main 方法) csc /out:file.exe  file.cs       //使用 /out 指定输出的文件 如果编译的stu.cs 和 fil

4.1 对每个命令行参数打印文件类型

file/filetype.c #include "apue.h" int main(int argc, char *argv[]) { int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[i]); if (lstat(argv[i], &buf) < 0) { err_ret("lstat error"); c

Linux命令行–理解Linux文件权限(转)

6.1.1 /etc/passwd文件 /etc/passwd:包含系统用户账户列表以及每个用户的基本配置信息 每个条目有七个字段,每个字段用冒号隔开 登录用户名 用户密码 用户账户的UID 用户账户的GID 用户账户的文本描述 用户HOME目录的位置 1 rich:x:501:501:Rich Blum:/home/rich:/bin/bash 默认情况下,bash shell启动时会自动处理用户主目录下.bashrc文件中的命令 linux系统将用户密码保存在另一个单独的文件中(称为shad

Windows脚本命令行版

运行时界面如下: Windows脚本命令行版.rar

MySQL命令行导入sql文件时出现乱码解决方案

Note: sql> source F:weibo.sql(执行相关sql文件) sql> select * from sina into outfile "/weibo.txt"(导出相应数据到C:的weibo.txt) 1. mysql 5.0后其客户端仅支持gbk,故可在sql> set names gbk; 例如: set names gbk; /* Navicat MySQL Data Transfer Source Server : localhost_3

命令行导入SQL文件

摘要:把数据库导出为XX.sql格式的数据库文件,导入到另外一个数据库中的时候,总是无法全部导入.及时用mysql的命令界面导入依然是无法全部导入.老师告诉我:在命令行中运行的效率和成功率是最快和最高的.所以查了一下如何用命令行导入SQL文件,方法很简单! 1.首先运行cmd(注意此处要用管理员身份运行)或者“开始菜单”-->附件-->命令提示符(右键)-->以管理员身份运行 2.进入mysql的bin目录 3.运行:mysql -u root -proot test <I:\re