在两个文件夹之间循环并使用获取的文件执行操作

在两个文件夹之间循环并使用获取的文件执行操作

我必须使用 .jar 比较两个 excel。但是,使用以下代码,我只能获取一个文件夹 (MasterFolder1) 的值,而无法获取另一个文件夹 (MasterFolder2) 的值

@echo off
set /p "MasterFolder1=MasterFolder1:"
set /p "MasterFolder2=MasterFolder2:"
Set "LogFile=%~dpn0.txt"
If exist "%LogFile%" Del "%LogFile%"

Set "PECfolder=C:\SunilKK-Latitude-E6430s\SunilKK\Software\PreciseExcelComparator\v1.1\PreciseExcelComparator_PEC"
PushD "%PECfolder%" || ( Echo can't locate %PECfolder% &Pause&Exit /B 0)

FOR /f "delims=" %%f IN ('dir /b /s "%MasterFolder1%\*.xls"') do (
    If exist "%Masterfolder2%\%%~nxf" (
        call java -jar PEC.jar "%%~ff" "%Masterfolder2%\%%~nxf" 0 0
    ) else (
        echo No pendant to "%%f" found in "%MasterFolder2%" >> %"LogFile%"
    )
)
pause

相关内容