只需将输入文件拖放到此批处理脚本上,您将得到一个新文件,其中包含相同的单词,并用冒号分隔:
@echo off
Mode 70,3 & color 0A
Title Find lines have the similar words separated by a colon
set "ScriptName=%~nx0"
if "%~1"=="" goto error
echo(
echo Find lines have the similar words separated by a colon
Set "OutputFile=newfile.txt"
If exist "%OutputFile%" Del "%OutputFile%"
for /f "tokens=1,2 delims=:" %%a in ('Type %1') do (
If [%%a]==[%%b] echo %%a:%%b
)>>"%OutputFile%"
Start "" "%OutputFile%" & Exit
::****************************************************************
:Error
Mode 70,5 & color 0C
echo( & echo(
echo You should drag and drop your file over "%ScriptName%"
Timeout /T 5 /nobreak>nul & exit
::****************************************************************