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バッチ】配列のような変数を扱う

Posted at

Windowsバッチでは他の言語でいうところの配列のような機能はサポートされていないが、環境変数名に「[]」のカッコは使用できるため、見かけ上は配列のような環境変数を扱うことができる。

test.bat
set test[0]=5
set test[1]=10
set test[2]=15

for /l %%i in (0,1,2) do (
    echo test[%%i]
)
出力結果
5
10
15

当然だが配列ではないのでソート等の機能は利用できず、見かけ上配列「っぽい」というだけである。

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?