batchfile to check version from textfile

A S
A S used Ask the Experts™
on
hello all,

I have a batchfile to check version from text file, if it matches do something for now

cmd.exe /c type \\version.txt | find /i "14.56"

if it matches to version in text file dont do anything, if it matches run following command

cscript.exe Messagebox.vbs "STOP"

if it doesnot matches run

cscript.exe Messagebox.vbs "Success"

regards
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
End-user support
Commented:
Save this to a file like test.bat:
find /i "14.56" version.txt
if errorlevel 1 (
   set result="Success" 
) else (
   set result="STOP"
)

::Create the VBS script with an echo statement:
ECHO wscript.Msgbox("%result%",vbOKOnly, "")>%TEMP%\~input.vbs

:s_GetInput
:: Run the vbScript
cscript //nologo %TEMP%\~input.vbs

:: Delete the VBS file
DEL %TEMP%\~input.vbs

Open in new window

Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
I'm not sure that the description of what to do is correct, but I would rather use
find /i "14.56" version.txt >nul && (
   REM the version is correct, do something
   set result="Success" 
) || (
   REM if version does not match ...
   set result="STOP"
)

Open in new window

A S

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial