Computing.Net > Forums > Disk Operating System > Replacing a Line in an Ini file

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.

Replacing a Line in an Ini file

Reply to Message Icon

Name: Leenix
Date: October 15, 2009 at 02:50:09 Pacific
OS: Windows Vista
CPU/Ram: 7Gbyte Ram / Core 2 Duo 3Ghz
Product: Microsoft Upg-vc msdos 6.22
Subcategory: General
Comment:

I have an Ini file that contains the following:

[CfgProfile_##InOffice##]
AuthExtension=100
AuthPIN=f4d37e3c8f40d0e3
ServerHost=10.172.0.2
ServerPort=5486
TunnelEnable=0
TunnelDstLocalIP=
TunnelPassword=abc
TunnelPort=5090


I've been trying to make a Batch file to replace the "Server Host=" line with "Server Host=10.172.0.2"

And do the same with the "AuthExtension="


I made a script that deletes those specific lines, but i just cant get to understand how you can insert / replace that line.

Does anyone here know how to do it? It's bothering the hell out of me.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 15, 2009 at 06:53:50 Pacific
Reply:

If you're using Vista this is the wrong forum.

If you're using DOS it ain't gonna be easy.


=====================================
Helping others achieve escape felicity

M2


0

Response Number 2
Name: Leenix
Date: October 16, 2009 at 05:44:40 Pacific
Reply:


@echo off & setlocal EnableDelayedExpansion
pushd "c:\AB\3CX1\3cx ass\data\"
for /F "delims=" %%j in ('find /v "" ^< "PATH OF YOUR FILE"') do (
set line=%%j
set line=!line:c--t=TUNNEL!
echo.!line!>> "THE NEW FILE TO CREATE"
)
del "PATH OF YOUR FILE"
rename "THE NEW FILE TO CREATE" *.txt
popd
:: End_Of_Batch

I have to say it drove me nuts literally.... I was moaning in the office all day. Now i'm having a nice piece of pizza to reward myself.


0

Response Number 3
Name: Daniel G. Gionco
Date: October 17, 2009 at 05:51:07 Pacific
Reply:

Try Horst Schaeffer`s Inifile.com:

http://home.mnet-online.de/horst.mu...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Replacing a Line in an Ini file

Append to a Line in a .bat file www.computing.net/answers/dos/append-to-a-line-in-a-bat-file/984.html

Inserting text into files using some DOS www.computing.net/answers/dos/inserting-text-into-files-using-some-dos/7134.html

How to find and replace a string www.computing.net/answers/dos/how-to-find-and-replace-a-string/7591.html