Batch file trouble
|
Original Message
|
Name: KoolFrank87
Date: February 5, 2008 at 05:03:51 Pacific
Subject: Batch file troubleOS: XPCPU/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
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: keridbey
Date: February 5, 2008 at 08:41:48 Pacific
Subject: Batch file trouble |
Reply: (edit)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. :)
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Mechanix2Go
Date: February 6, 2008 at 01:31:31 Pacific
Subject: Batch file trouble |
Reply: (edit)@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
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: