Export (0) Print
Expand All
Expand Minimize

Converting VBScript's Dim Statement

Windows PowerShell

Definition: Declares variables and allocates storage space.


In VBScript the Dim statement is used to declare a variable, typically without assigning that variable a value of any kind. To declare a variable in Windows PowerShell, but without assigning a value to the variable, use a command similar to this:

$a = [string]

This command creates a new, empty string variable named $a. In order to declare a variable without assigning it a value you must specify a data type (although this data type can later be changed).

Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft