Shahar Gvirtz's Weblog

[Tip] Option Explicit in PowerShell

Someone asked me how we can set Windows PowerShell to work like in VB when you specify Option Explicit.
How to disable using of variables that didn't defined in the code. In this way, you know for sure that you aren't use undefined variable and get unexpected results.

to do "Option Explicit" in PowerShell, simply run this command:

set-psdebug -strict

and to disable the Option Explicit:

set-psdebug -off

Shahar.

Comments

Wound Care said:

This blog is very nice and informative. it is pretty hard task but your post and experience serve and teach me how to handle and make it more simple and manageable.

# October 22, 2011 3:50 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)