JSI Tip 7373. How do I set an environment variable to an INI file key?


Marty List brings us iniTool.zip to query keys from INI formatted files.

The ReadMe.txt file contains:

iniTool \[Version 1.00\]

Queries keys from INI formatted files.


The syntax of this command is:

iniTool.exe /f:filename /s:section /k:key

 /f: Path to an INI format file. Use double quotes if the path contains spaces.
 /s: Section name. Use double quotes if the name contains spaces.
 /k: Key name. Use double quotes if the name contains spaces.


Examples:
  iniTool.exe /f:X:\FolderName\FileName.ini /s:Section1 /k:Key1
  iniTool.exe /f:"X:\Folder Name\File Name.ini" /s:"Section 2" /k:"Key 2"


An argument of /? or -? displays this syntax and always returns 1.
A successful completion will return 0.

Copyright 2003 Marty List

Example:

To set an environment variable equal to the timer value of the \[drivers\] section of the %systemroot%\System.ini file:

for /f %%d in ('initool /f:%systemroot%\System.ini /s:drivers /k:timer') do set VAR=%%d



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish