Ini file

logayna ahmed
logayna ahmed used Ask the Experts™
on
I am wondering if it is possible to change a line in an ini file using a batch script to a specific directory on a drive
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
It depends a little bit about what the INI file looks like, and what the change is?  Can you provide a sample, and a before and after version showing the change you want to make?


»bp
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
Just to give you some additional ideas as well.

I often use the following small, lightweight, free utility to make INI file changes from a BAT script.  It's a great little tool to have in your drawer of useful utilities.

Horst Schaeffer's Software Pages

If you want to see an example of doing it the hard way in pure BAT code, take a look at this solution I did for a prior question...

Bat File for inserting username token into path and finding/replacing text in an .ini file


»bp
Hello Bill,

nice little tool, thanks for sharing.

leflon

Sorry for spamming the Q.
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
@Leflon,

Welcome, take a look at some of the other stuff on that site, he has some useful, and lean, utilities that I find useful.  DELAGE32 is another great tool in my oppinion...


»bp
Directly from bat without additional tools this is up to my knowlesge not possible.

If you have python3 already installed, then it is very easy to write a script changing lines in a config file.

Do you have to preserve potential comments in this file?
Then it would be a little bit more difficult.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial