WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

System INI and INI File Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

InideletePvt with @wholesection

Keywords:    inidelete wholesection

Question:

I am trying to remove a section in a program and am using the INIReadPvt function to get @WHOLESECTION. It appears the EXE looks for a KEY @WHOLESECTION rather than interpreting it to delete the entire section.

Is there an elegant way with quotes or percents or SOMETHING so I don't have to parse the line first and decide if I need to get the entire section?

Answer:

This works for me. Notice there are no quotes around @wholesection:
        IniDeletePvt("sectionName",@WHOLESECTION, "path\whatever.ini")
@WHOLESECTION is a built in constant in WinBatch. But sometimes by the time you get to it (if you're doing variable substitution), it has transmogrified itself into a string of "@WHOLESECTION". This is the part that needs to be fixed.

Try:

IniFileName = ItemExtract(1,IniEntry, ",")
SectionName = ItemExtract(2,IniEntry, ",")
KeyName=ItemExtract(3,IniEntry, ",")

Message("Sectioname before",Sectionname)

if Sectionname=="@WHOLESECTION" then Sectionname=@WHOLESECTION

Message("Sectioname after",Sectionname)

Article ID:   W13336
Filename:   IniDelete Wholesection.txt
File Created: 1999:04:15:16:53:20
Last Updated: 1999:04:15:16:53:20