Link to home
Start Free TrialLog in
Avatar of logayna ahmed
logayna ahmed

asked on

Ini file

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
Avatar of Bill Prew
Bill Prew

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
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.
@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.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.