Skip to content

Read/write win.ini

chris.bezant

Asked Feb 24, 2004, 6:23 AM EST1 answer
Share
LinkedInX
Does anyone know how I can read/write to win.ini, please? Tried trawling the help but can only find references to ConfigureSettings to maintain a config file related to my program. I need access to the win.ini because other programs already use that and I need to get at the data there. Thanks.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi, here is a small C# component that can read and write INI files.
    Also here is an example how you can use it in order to retrieve all its data:
    C#
    IniFile winIni = new IniFile();
    winIni.Load(@"C:\Windows\win.ini");
     
    foreach (IniSection section in winIni.Sections)
    {
        Console.WriteLine("Section's name: {0}", section.Name);
        foreach (IniKey key in section.Keys)
            Console.WriteLine("Key's name: {0} | Key's value: {1}", key.Name, key.Value);
    }
    0