@Echo off
rem Info zur Version:
rem sucht einen File via Path returend File_DPNE und File_info
rem Datum        Wer     Info
rem 25.06.2010   J.Fes   ersterstellung

if not #%1#==## goto :endIf
 Echo ##Debug
 Echo Err: [Call %0]& Echo Err: missing paramters
 Echo Inf: P1=File_NE P2=FileFound_DPNE P3=FileInfo  P4=FileVer P5=FileDate P6=FileSize
 Echo Example: call %0 adsldpc.dll FileFound_DPNE FileInfo
 call %0 adsldpc.dll FileFound_DPNE FileInfo FileVer FileDate FileSize
 echo FileFound_DPNE:%FileFound_DPNE%
 echo FileInfo      :%FileInfo%
 Echo FileVer       :%FileVer%
 Echo FileDate      :%FileDate%
 Echo FileSize      :%FileSize%

 Echo Example: call %0 NotExistingFile.NOF FileFound_DPNE FileInfo
 call %0 NotExistingFile.NOF FileFound_DPNE FileInfo FileVer FileDate FileSize
 echo FileFound_DPNE:%FileFound_DPNE%
 echo FileInfo      :%FileInfo%
 Echo FileVer       :%FileVer%
 Echo FileDate      :%FileDate%
 Echo FileSize      :%FileSize%

 pause
 goto :eof
:endIf


setlocal
 set CurCmdRoot_DP=%~dp0
 set CurCmdRoot_DP=%CurCmdRoot_DP:~0,-1%
 set path=%CurCmdRoot_DP%;%Path%

 set FileToFind_NE=%1
 rem Echo  FileToFind_NE=%FileToFind_NE%
 call :FileFindInSysPath %FileToFind_NE% FileFound_DPNE
REM  Echo FileFound_DPNE:%FileFound_DPNE%
 set FileVer=
 set FileSize=
 set FileDate=
 set FileVerInfo=
 if "%FileFound_DPNE%" equ "" goto :FFNotFound

 set filever_temp_dpne=%temp%\filever_temp.tmp
 filever.exe "%FileFound_DPNE%">"%filever_temp_dpne%"
 FOR /F "delims=" %%i in (%filever_temp_dpne%) do set FileVerInfo=%%i
 del %filever_temp_dpne%
 FOR /F "tokens=5 delims= "  %%i IN ("%FileVerInfo%") do set FileVer=%%i
 FOR /F "tokens=7 delims= "  %%i IN ("%FileVerInfo%") do set FileSize=%%i
 FOR /F "tokens=8 delims= "  %%i IN ("%FileVerInfo%") do set FileDate=%%i
 
 :FFNotFound
 
endlocal& set %2=%FileFound_DPNE%& set %3=%FileVerInfo%& set %4=%FileVer%& set %5=%FileDate%& set %6=%FileSize%
goto :eof

rem ----------------------------------------------------------------------------
:FileFindInSysPath
 setlocal
  rem Echo %0 search for:[%1]
  set FileFound_DPNE=%~f$PATH:1
  rem Echo FileFound_DPNE:%FileFound_DPNE%
 endlocal& set %2=%FileFound_DPNE%
 goto :eof




