Computing.Net > Forums > Programming > Batch file trouble

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file trouble

Reply to Message Icon

Name: KoolFrank87
Date: February 5, 2008 at 05:03:51 Pacific
OS: XP
CPU/Ram: 1 Gig
Comment:

I am currently making a script that checkes for a folder or file and will install or skip depending on the result. So if program1 exists then it will goto the next line, if not then it will run the installer. This is very handy for me when working on many machines. My question is, Is it possible to check for versions? I have found a couple of the programs have INI files with the version number in it, could I use FIND to help determine if it needs to be installed?

Thanks

Frank



Sponsored Link
Ads by Google

Response Number 1
Name: keridbey
Date: February 5, 2008 at 08:41:48 Pacific
Reply:

I've used something similar in my scripts. How to do it depends on the format of the INI file. For instance:

MyINI
ProgramTitle: Thingy.exe
Version: 7.02
Owner: M. Nom de Plume

For something like that, I would try this:

for /f "tokens=2 delims= " %%a in ('type C:\MyINI.ini ^| findstr "Version:"') do set Version=%%a
if %version% EQU 6.02 start C:\MyInstaller.exe
if %version% EQU 7.02 echo Version is 7.02; no install needed.

Of course, if your INI looks nothing like the one I just made up, we might have to tweak the FOR line. :)


0

Response Number 2
Name: Mechanix2Go
Date: February 6, 2008 at 01:31:31 Pacific
Reply:

@echo off
find /i "version" < my.ini | find "7.02" > nul
if not errorlevel 1 echo Version is 7.02; no install needed




=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: KoolFrank87
Date: February 7, 2008 at 05:25:35 Pacific
Reply:

M2 your script worked perfectly. Thanks for the help. Ill be back with alot more questions :-)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file trouble

Batch File trouble www.computing.net/answers/programming/batch-file-trouble/18865.html

Batch file troubles www.computing.net/answers/programming/batch-file-troubles/17359.html

Batch file command line www.computing.net/answers/programming/batch-file-command-line/12068.html