根据后缀名,调用不用的比较工具
2021/09
07
14:09
@echo off
chcp 65001
set dir=%~dp0
set fname="%dir%ExcelCompare.txt"
set file1=%~1
set file2=%~2
set spread_sheet_path="C:\Program Files (x86)\Microsoft Office\Office15\DCF\SPREADSHEETCOMPARE.EXE"
set beyond_compare_path="C:\Program Files (x86)\Beyond Compare 3\BCompare.exe"
pushd "%dir%"
set ext1=%file1:~-4%
set ext2=%file2:~-4%
for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set ext1=%%ext1:%%i=%%i%%
for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set ext2=%%ext2:%%i=%%i%%
set extc=
if "%ext1%"=="xlsx" (
set extc=%extc%1
)
if "%ext1%"==".xls" (
set extc=%extc%1
)
if "%ext2%"=="xlsx" (
set extc=%extc%1
)
if "%ext2%"==".xls" (
set extc=%extc%1
)
if "%extc%"=="11" (
echo call spread sheet compare
echo %file1%> %fname%
echo %file2%>> %fname%
%spread_sheet_path% %fname%
)
if "%extc%"=="1" (
echo call beyond compare 1
%beyond_compare_path% "%file1%" "%file2%"
)
if "%extc%"=="" (
echo call beyond compare 2
%beyond_compare_path% "%file1%" "%file2%"
)
popd
-----------------------------------------------
注释:
%str:~5%
从第0开始,截取5个
%str:~-5%
倒数截取5个
for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call set SHEET_NAME_LOWER=%%SHEET_NAME_LOWER:%%i=%%i%%
转换为小写
CopyRights: The Post by BY-NC-SA For Authorization,Original If Not Noted,Reprint Please Indicate From 老刘@开发笔记
Post Link: 根据后缀名,调用不用的比较工具
Post Link: 根据后缀名,调用不用的比较工具