返回列表 发帖
回复 1# WBATW
@echo off
cd /d "%~dp0"
set "InFile=list.log"
set "OutFile=list.log.new"
setlocal enabledelayedexpansion
(for /f "delims=" %%i in ('dir /b /a-d "*.pdf"') do (
    set /p str=
    echo !str!=%%i
))<"%InFile%" >"%OutFile%"
move /y "%OutFile%" "%InFile%"
pauseCOPY
测试代码之前请做好备份

TOP

回复 13# WBATW
@echo off
cd /d "%~dp0"
set "InFile=list.log"
set "OutFile=%temp%\list.log.new"
setlocal enabledelayedexpansion
(for /f "delims=" %%i in ('dir /b /a-d ^| findstr /v /c:"%InFile%" /c:"%0"') do (
    set /p str=
    echo !str!=%%i
))<"%InFile%" >"%OutFile%"
move /y "%OutFile%" "%InFile%" >nul
pauseCOPY
测试代码之前请做好备份

TOP

回复 15# WBATW


1、list.log文件不要放进%temp%目录下,14楼的代码是要求list.log和bat文件在同一个目录下。
2、把@echo off删掉,再每一行下面都加上pause,看看是到哪一步出错的,报错信息是什么。
测试代码之前请做好备份

TOP

返回列表