Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 688
  • Last Modified:

get program version number

i have a vb exe that i am copying into production.  the output of this is piped to a text file.  is there anyway i can get the version number of the exe so i can also send it to the text file.

for example: if i currently have version 1.1.3 in and i want to move in 1.1.4 i would need to get the version on the old file and the new file and pipe that output to the file.

thanks
0
Fraser_Admin
Asked:
Fraser_Admin
  • 2
1 Solution
 
Fraser_AdminAuthor Commented:
can get the program version using vbscript, but cannot figure out how to return the value to my calling program (batch file).  any ideas here?
0
 
MSE-dwellsCommented:
Show us how you're doing whatever you've got so far.
0
 
Fraser_AdminAuthor Commented:
i ended up just put the output to a file now i'm comparing the two files to see if the version is the same.
0
 
canaliCommented:
Something like this?
byBye Gastone Canali
@echo off
::
:: getfilever.cmd
:: byBye Gastone Canali 
setlocal
pushd %~d0%~p0
set filename=%~n0
set logfile="%temp%\_%filename%.txt"
:: create empty log files
type nul>%logfile%
set newver=1.1.4
set pathToYourExe="C:\Program files\Internet Explorer\iexplore.exe"
 
call :_GETVER  %pathToYourExe%
echo Version: %v%
rem checkversion
echo %v% | find /v "%oldver%" >nul && call :_diffVER %newver% >>%logfile%
echo Version: %v% >>%logfile%
 
goto :_END
:_diffVER
rem  version is different:do something...
echo The file is the not new version %1 but %v%
goto :_EOF
:_GETVER
:: create vbs helper 
:: (every time the funtion is called, put on top of the batch if u don't like it)
 call :_CREATEVBSHELPER
 if not exist %1 goto :_ERR
 for /f "delims=!" %%v in ('cscript //nologo %temp%\filever.vbs %1') do set v=%%v
goto :_EOF
:_CREATEVBSHELPER
set vbshelper=%temp%\filever.vbs
echo>%vbshelper%  Set objFSO = CreateObject("Scripting.FileSystemObject")
echo>>%vbshelper% Wscript.Echo objFSO.GetFileVersion(wscript.arguments(0))
goto :_EOF
:_ERR
set v= file not found!
:_END
:_EOF

Open in new window

0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now