4
6

More than 3 years have passed since last update.

powershell/Start-ProcessとInvoke-Expressionの違い

Last updated at Posted at 2020-01-22

1.Invoke-Expression
・引数も含めて1行で記載できる
・非同期実行しかできない(すぐ次の行が実行される)
・batファイルをキックした場合に、batの中の「%~dp0」の解釈が
「カレントディレクトリ」の為パス結合の際にbat内の記載で¥が必要
・psexecを実行して更にBAT_to_Exe_Converterで作成したEXEをキックすると、内包ファイル郡が展開される

2.Start-Process
・引数は別(-ArgumentList)
・同期実行ができる(-Waitで終わるまで待てる)

・batファイルをキックした場合に、batの中の「%~dp0」の解釈が
「カレントディレクトリ¥」の為パス結合の際にbat内の記載で¥が不要
・psexecを実行して更にBAT_to_Exe_Converterで作成したEXEをキックすると、内包ファイル郡が展開されない

4
6
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
4
6