Jump to content

[SOLVED]How to remove a section from ini file?


ahmetpi
 Share

Recommended Posts

 

Hi

How can i delete a section in ini file?

I want to delete the section itself, not the keys and values in the section.

If I use inidelete, the name of the section remains in the ini file.

Example:

ini file:

[EXAMPLE]
key1=value1
key2=value2

If i use ini delete;

[EXAMPLE]

So, how can i remove this section name from ini file?

Thanks

Edited by ahmetpi
Link to comment
Share on other sites

  • Moderators

How about posting your script to show us what you're doing? IniDelete will, if you do not specify a key, delete the entire section. The example code below creates 5 sections, and then deletes the third.

For $a = 1 To 5
    IniWrite(@DesktopDir & "\my.ini", "NewSection" & $a, "MyKey", "Val")
Next

Sleep(1000)

IniDelete(@DesktopDir & "\my.ini", "NewSection3")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

18 minutes ago, JLogan3o13 said:

How about posting your script to show us what you're doing? IniDelete will, if you do not specify a key, delete the entire section. The example code below creates 5 sections, and then deletes the third.

For $a = 1 To 5
    IniWrite(@DesktopDir & "\my.ini", "NewSection" & $a, "MyKey", "Val")
Next

Sleep(1000)

IniDelete(@DesktopDir & "\my.ini", "NewSection3")

 

I made a mistake while writing the code

Problem is solved, thanks for helping

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...