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
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?
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 :-)
Summary: Hi guys Having some trouble getting a code to work to extract the numerical values out of the following two lines into a seperate variable each to be called later in my batch file. These two lines are...
Summary: defrag c: -v -f echo y|chkdsk /F c: shutdown -r The above is my little ameature batch file it will defrag then when finished it will goto next line where it does chkdsk /F for fix sectors but it requ...
Summary: I am in the process of creating a batch file that will present the user with a few options (using CHOICE), and then execute certain commands depending on the choice by the user. So far, I have the men...