Help us understand the problem. What is going on with this article?

変数をコマンド実行する

More than 5 years have passed since last update.

用途

Invoke-Expression

スクリプト内で変数組み立てをした時など。

PS D:\temp> $test1="get"
PS D:\temp> $test1+="`-childitem"
PS D:\temp> $test1
get-childitem

PS D:\temp> invoke-expression $test1


    ディレクトリ: D:\temp


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        2014/03/27     23:22         16 test1.txt


PS D:\temp>
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away