Jump to content

Two Simple Problems


Recommended Posts

Dear MSFNers...

I'm deeply troubled :( by two problems for my ignorance of writting advanced Batch files. Here're these:

1>>I have thought out a small scheme of installation where i want to do the following set of actions:

A. An executable (say, program.exe) if run from a batch file will generate a report file (named, report.txt) that may have informations like "GenuineIntel", "VIA/S3G Unichrome IGP" etc.

B. I'll have a template information file named Template.txt inside some directory in my CD which obviously have the "GenuineIntel", "VIA/S3G Unichrome IGP" etc. type informations pre-written.

C. Now, "GenuineIntel" string is to be matched between report.txt and template.txt. If the string is found then a "certain.exe" file will be launched from the cd. If the string is not found in report.txt then some "other.exe" file will be executed from the CD.

Now, i am completely new to writting batch files and really can't sort out the method. Can anybody help me by writting some batch routines for the sake of achieving these tasks?

2>>My next problem is in the area of finding "First Unutilized Drive Letter" in a system. My system has a HDD partitioned into 7 Partitions (C D E F G H I) and one CD-ROM (J:) and a CD-RW (K:). Now, somewhere inside the forum i found a batch file which can find "First Available Drive Letter". Problem is that it always finds my CD-ROM (J:) as the first available drive letter, just because there is no CD inside it. While my requirement is that the batch file should always find out "L:" as the next drive letter. Can this be achieved from a batch file? That's the reason for mentioning "First Unutilized Drive Letter" which if searched will find L: even if there's no CD inside either CD-ROM or CD-RW drive.

I hope i could make you understand my problems. Please provide some solutions if you noticed this post.

Thanks in advance...please help...

Edited by MOONLIGHT SONATA
Link to comment
Share on other sites


Dear MSFNers...

I'm deeply troubled :(

Me too!
2>>My next problem is in the area of finding "First Unutilized Drive Letter" in a system. My system has a HDD partitioned into 7 Partitions (C D E F G H I) and one CD-ROM (J:) and a CD-RW (K:). Now, somewhere inside the forum i found a batch file which can find "First Available Drive Letter". Problem is that it always finds my CD-ROM (J:) as the first available drive letter, just because there is no CD inside it. While my requirement is that the batch file should always find out "L:" as the next drive letter. Can this be achieved from a batch file? That's the reason for mentioning "First Unutilized Drive Letter" which if searched will find L: even if there's no CD inside either CD-ROM or CD-RW drive.
Here is an example which should work in XP
@echo off&Mode 33,2&Color b2&Title Script By YzOwl
for %%? in (z y x w v u t s r q p o n m l k j i h g f e d c) do (
fsutil fsinfo drivetype %%?:|find "No such Root Directory">nul 2>&1&&set nextfree=%%?:
)
echo/The next free drive letter is %nextfree%&ping -n 11 127.0.0.1>nul&goto :eof

Link to comment
Share on other sites

@ Dear YzOwl,

you know when i posted my problems i had only you in my mind. Please read "Dear MSNers" as "Dear YzOwl". i knew it can't and shouldn't bypass you. thanks, your posted code works, failure rate of your codes are always at almost( with some modesty) zero level. BTW, what about the first one, sir? please help as i've seen you always rescued everybody in their batch troubles.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...