Efficient File Management with IniFile Component: A Comprehensive Guide

Efficient File Management with IniFile Component: A Comprehensive Guide

Jason Lv8

Efficient File Management with IniFile Component: A Comprehensive Guide

Table of Contents

Disclaimer: This post includes affiliate links

If you click on a link and make a purchase, I may receive a commission at no extra cost to you.

IIniFilesComponent

This interface imports, creates, and gets INI files.

https://techidaily.com

Declaration

IIniFilesComponent : IDispatch

https://techidaily.com

Properties

Array Files - Gets all the INI files from the project.

https://techidaily.com

Methods

ImportIniFile(IFolder target, String source) - Import an INI file from disk with the specified source path. The INI file is imported in the target folder.

ImportIniFileS(String target, String source) - Import an INI file from disk with the specified source path. The INI file is imported in the target folder specified path.

CreateIniFile(IFolder target, String name) - Creates a new INI file in the project and returns it. The INI file is added in the target folder, with the specified name.

CreateIniFileS(String target, String name) - Creates a new INI file in the project and returns it. The INI file is added in the target folder path, with the specified name.

 $advinst = new-object -com AdvancedInstaller

$prj = $advinst.LoadProject(“d:\edit_ini.aip”)
$settingsIni = $prj.IniFilesComponent.Files | where {$.Name -eq “Settings.ini”}[0]
$configSection = $settingsIni.Sections | where {$
.Name -eq “Configuration”}[0]
$newEntry = $configSection.CreateIfNotExist(“new_entry”, “my_value”)
$csvEntry = $configSection.CreateOrAppendCommaSeparated(“comma_separated_value”, “my_value”)
$newOrUpdateEntry = $configSection.CreateOrUpdate(“update_entry”, “my_value”)
$removeEntry = $configSection.CreateEntryRemoval(“entry_to_remove”)
$prj.Save()

Copy

See also

IAdvinstProject

IFoldersComponent

IIniFile

IPredefinedFolders

Topics

Did you find this page useful?

Please give it a rating:

Thanks!

Report a problem on this page

Information is incorrect or missing

Information is unclear or confusing

Something else

Can you tell us what’s wrong?

Send message

Also read:

  • Title: Efficient File Management with IniFile Component: A Comprehensive Guide
  • Author: Jason
  • Created at : 2024-10-06 02:29:08
  • Updated at : 2024-10-10 22:23:57
  • Link: https://fox-useful.techidaily.com/efficient-file-management-with-inifile-component-a-comprehensive-guide/
  • License: This work is licensed under CC BY-NC-SA 4.0.