Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 2.0 » New-Variable

New-Variable - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

New-Variable


Short description
Creates a new variable.

Syntax
New-Variable [-Name] <string> [[-Value] <Object>] [-Description <string>] [-Force] [-Option {None | ReadOnly | Cons
tant | Private | AllScope}] [-PassThru] [-Scope <string>] [-Visibility {Public | Private}] [-Confirm] [-WhatIf] [<C
ommonParameters>]

Description
The New-Variable cmdlet creates a new variable in Windows PowerShell. You can assign a value to the variable while 
creating it or assign or change the value after it is created.

You can use the parameters of New-Variable to set the properties of the variable (such as those that create read-on
ly or constant variables), set the scope of a variable, and determine whether variables are public or private.

Typically, you create a new variable by typing the variable name and its value, such as "$var = 3", but you can use
 the New-Variable cmdlet to use its parameters.