Computing.Net > Forums > Programming > Need to read ini and more...

Need to read ini and more...

Reply to Message Icon

Original Message
Name: mousie617
Date: February 16, 2004 at 13:45:28 Pacific
Subject: Need to read ini and more...
OS: WinXP
CPU/Ram: P3 800mhz
Comment:

This message was originally posted in the WinXP section. I would prefer to have a windows xp batch file to do the following, but someone told me to post here.

What I need to do is backup files in a particular directory. The path is in the Windows.ini file as LAUNCH=C:\UTILITIES\LAUNCH.EXE. I need this batch file to have the ability to run from any drive letter. The path may also be different, depending on where the user decided to install the program. So, here's what I need, if possible, in a batch file...

Read the win.ini, find the entry listed above (LAUNCH=), parse out the entry to change to the drive letter, then CD to the directory (omitting the executable). Then continue on with my batch file. Is this possible?

Thanks for the help!
David


Report Offensive Message For Removal

Response Number 1
Name: SN
Date: February 16, 2004 at 14:36:23 Pacific
Subject: Need to read ini and more...
Reply: (edit)

I am hardly an expert, but to my knowledge, batch files don't have the capability to "read in" or parse files.

Then again, I'm amazed at what some people are able to do with batch files, so I suppose it's possible (having a batch file call itself with the contents of win.ini sent as "parameters" via STDIN?)

Anyhow, consider using a real, live programming language. Perl would be pretty straightforward on this one. If this is an option, post back and we'll give it to you in one language or another.

Good luck,
-SN


Report Offensive Follow Up For Removal

Response Number 2
Name: mousie617
Date: February 17, 2004 at 05:19:04 Pacific
Subject: Need to read ini and more...
Reply: (edit)

Thanks SN, but I know that it can be done. I came close using the Date function to read in a variable, but I had a problem stripping off the file name to change directories. The problem with programming languages is overhead. I need a quick and dirty backup routine that fits on a floppy and doesn't require an installation proceedure. Thanks for the offer of other programming languages, but I'm sure someone has the answer.
Ty,
David


Report Offensive Follow Up For Removal

Response Number 3
Name: FishMonger
Date: February 17, 2004 at 08:52:56 Pacific
Subject: Need to read ini and more...
Reply: (edit)

David,
If you're unable to find the batch file answer and want to reconsider using another approach, Perl can do this more efficiently than the batch file and can be compiled and put on a floppy without the need to install anything on the machines (with the exception of the computer that you use to write the Perl script).



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Need to read ini and more...

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software