VBS Script to change INI File

chrisglissman
chrisglissman used Ask the Experts™
on
Hello

I have a VBS file under C:\windows\sigplus.ini

I have a line inside the the file that looks like this

Tablettype=5


I need a vbs script that will change the tablet type to 7 when i run it.


Can anyone help with this? Please post script. If i test it and it works you will recive the points ASAP.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
This should do it.
Cosnt FILENAME = "C:\windows\sigplus.ini"
Dim objFso, objFile, varBuffer
Set objFso = CreateObject("Scripting.FileSystemobject")
Set objFile = objFso.OpenTextFile(FILENAME)
varBuffer = objFile.ReadAll
objFile.Close
Set objFile = objFso.CreateTextFile(FILENAME,True)
objFile.Write Replace(varBuffer,"Tablettype=5","Tablettype=7")
objFile.Close
Set objFile = Nothing
Set objFso = Nothing
WScript.Echo "Done"

Open in new window

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