0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Windowsバッチ】iniファイル形式のテキストファイルを読み込む

Last updated at Posted at 2023-07-24

iniファイル形式のテキストファイルを読み込み、パラメータを環境変数に設定する。

test.bat
for /f "tokens=1,* delims==" %%a in (.¥test.ini) do (
    set %%a=%%b
)

「=」を区切り文字とし、その前後をそれぞれ環境変数名と設定値としてset文により環境変数に設定する。厳密にiniファイル形式として認識しているわけではないので、セクション等は考慮されていない点に注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?