Jump to content
ahmetpi

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

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...