Sign in to follow this  
Followers 0
attactician

Read registry key - write custom.ini

4 posts in this topic

Hello, I need to create an application that simply reads the value of a specific registry key, and then writes that value to a custom.ini file in the following format:

[sTART_CIM_OBJECT]

OEMDuplicatorString = laptopimage2010

[END_CIM_OBJECT]

The 'OEMDuplicatorString' is the name of the key I would be reading, and the value is to the right of the = sign.

If someone could start me in the right direction, I would take it from there, I just don't know how to start the code.

Thank you

Share this post


Link to post
Share on other sites



you could use iniwrite but that structure is set up like

[section]

1=some value

2=some value

3=

[next section]

1=

2=

etc

etc

if you were to use this option you would use

$reg=RegRead ( "keyname", "valuename" )

IniWrite ( "filename", "section", "key", $reg )

if the ini doesn't exist, it will be created.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I will give this a try, thank you!

you could use iniwrite but that structure is set up like

[section]

1=some value

2=some value

3=

[next section]

1=

2=

etc

etc

if you were to use this option you would use

$reg=RegRead ( "keyname", "valuename" )

IniWrite ( "filename", "section", "key", $reg )

if the ini doesn't exist, it will be created.

Edited by attactician

Share this post


Link to post
Share on other sites

That did it, with a little modification because iniwrite doesn't seem to support adding sections or anything extra, I used FileWrite in addition.

$reg=RegRead ( "HKLM\System\Setup", "OEMDuplicatorString" )

IniWrite ( "custom.ini", "START_CIM_OBJECT", "OEMDuplicatorString", $reg )
FileWrite ("custom.ini" , "[END_CIM_OBJECT]")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0