0
我需要在批处理脚本中实现另一批处理脚本。我有一个脚本可以扫描字符串并将它们输出到名为“strings.txt”的文本文件中,并且我想用另一批处理脚本删除重复的行。我想以某种方式将其他批处理脚本实现为我的。这是我需要应用的脚本。批量需要Dir命令帮助
@echo off
setlocal disableDelayedExpansion
set "file=%~1"
set "line=%file%.line"
set "deduped=%file%.deduped"
::Define a variable containing a linefeed character
set LF=^
::The 2 blank lines above are critical, do not remove
>"%deduped%" (
for /f usebackq^ eol^=^%LF%%LF%^ delims^= %%A in ("%file%") do (
set "ln=%%A"
setlocal enableDelayedExpansion
>"%line%" (echo !ln:\=\\!)
>nul findstr /ilg:"%line%" "%deduped%" || (echo !ln!)
endlocal
)
)
>nul move /y "%deduped%" "%~n1_deduped%~x1"
2>nul del "%line%"
我需要所有这些发生在我的文本文件中,但是所有这些或其变体都出现在我的脚本中。
这是什么都来用你在问题中提到的“DIR”命令。 – Squashman
[批处理从文本文件中删除重复行]可能的重复(http://stackoverflow.com/questions/11689689/batch-to-remove-duplicate-rows-from-text-file) – Squashman
要调用另一个批处理文件在批处理文件中,使用'CALL'。 – soja