attactician Posted February 18, 2010 Share Posted February 18, 2010 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 Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 18, 2010 Share Posted February 18, 2010 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 gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
attactician Posted February 18, 2010 Author Share Posted February 18, 2010 (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 February 18, 2010 by attactician Link to comment Share on other sites More sharing options...
attactician Posted February 18, 2010 Author Share Posted February 18, 2010 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]") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now