PowerTip: Read Only and Constant Variables

Doctor Scripto

Summary: Learn the difference between a read-only variable and a constant.

Question: What is the difference between a read-only variable and a constant?

Answer: A read-only variable is one with content that is read-only. It can, however, be modified by using the Set-Variable cmdlet with the –force parameter. It can also be deleted by using Remove-Variable –force.  A constant variable, however, cannot be deleted, nor can it be modified–even when using the force.

 

0 comments

Discussion is closed.

Feedback usabilla icon