Code to batch delete duplicate lines

Time:2021-1-28
Copy codeThe code is as follows:
@echo off
:: delete duplicate rows, but cannot leave empty rows
: the text that does not conform to the variable naming rules and the number of variables exceeds the limit cannot be handled correctly
::
(echo) file contents after clearing duplicate lines: & echo.) > str_ .txt
for /f “delims=” %%i in (test.txt) do (
if not defined %%i set %%i=A & echo %%i>>str_.txt)
start str_.txt