Click here to Skip to main content
14,599,610 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,

I created a batch file that compares two excel file (which exist in two different folder) with the help of PEC.jar tool, . However, my code is working as expected, but now i want to enhance my code and wants to read the excel file Property and to check if the Property of excel1 is equal to Property of excel2.

In my "excel file Properties" under the Custom tab below property is common and i want to compare only one property
Name                                                                
Fermat_Report_Name 

Value
AE CRD A00.01             

Type
Text



I want to compare this property in both the excel and then wants to call my PEC.jar tool. Below is my code which is currently working without comparing Excel File Property.

What I have tried:

@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"
::echo %PECfolder%
PushD "%PECfolder%" || ( Echo can't locate %PECfolder% &Pause&Exit /B 0)

FOR /f "delims=" %%f IN ('dir /b /s "%MasterFolder1%\*.xls"') do (
::echo %MasterFolder1%
    If exist "%Masterfolder2%\%%~nxf" (
        call java -jar "C:\SunilKK-Latitude-E6430s\SunilKK\Software\PreciseExcelComparator\v1.1\PreciseExcelComparator_PEC\PEC.jar" "%%~ff" "%Masterfolder2%\%%~nxf" 0 0
    ) else (
        echo No pendant to "%%f" found in "%MasterFolder2%" >> %"LogFile%"
    )
)
pause
Posted
Updated 17-Sep-19 20:21pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I'm affraid it's impossible to read embeded properties of Excel file via DOS command. See: Batch files - How To ... Read File Properties[^]
   
Comments
Sunil KK 18-Sep-19 3:06am
   
Hi Maciej, Thanks for the response. any other way to read the Excel File Properties?
Maciej Los 18-Sep-19 3:23am
   
Yeah, via Interop using VBScript. I do not see any other way.
Sunil KK 18-Sep-19 3:38am
   
ok, but in that case i will i integrate my current batch file with it?
Maciej Los 18-Sep-19 3:55am
   
I don't know. I have never done such of thing. I hope that is possible.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100