Click here to Skip to main content
14,638,900 members

How to read excel file custom property using batch file

Sunil KK asked:

Open original thread
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
Tags: batch

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).




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