LoginSignup
1
3

More than 3 years have passed since last update.

VBSからPowerShellへ (1)変数定義の強制

Last updated at Posted at 2019-05-04

VBS(VBScript)からPowershellへの移行に関して、作業用の備忘録。

変数定義の強制

VBSでよく出てくる未定義の変数を禁止するための
Option Explicit

これはPowershellの場合は
Set-StrictMode -Version 2.0
となる。

ただし、Option ExplicitSet-StrictModeは方向性として完全一致というわけでなく、さらに1.0と2.0ではチェック対象の厳格さが異なるが、通常はSet-StrictMode -Version 2.0を使えばいいかと。

・参考にさせていただいたページ
Set-StrictModeについてちょっとだけ詳しく説明してみる[https://blog.shibata.tech/entry/2015/11/10/233858]

1
3
4

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
1
3