Udostępnij za pośrednictwem


PSVariableIntrinsics.Set Method

Definition

Overloads

Set(PSVariable)

Sets the variable.

Set(String, Object)

Sets the variable to the specified value.

Set(PSVariable)

Sets the variable.

public:
 void Set(System::Management::Automation::PSVariable ^ variable);
public void Set (System.Management.Automation.PSVariable variable);
member this.Set : System.Management.Automation.PSVariable -> unit
Public Sub Set (variable As PSVariable)

Parameters

variable
PSVariable

The variable to set

Exceptions

If the maximum number of variables has been reached for this scope.

If variable is null.

If the variable is read-only or constant.

Applies to

Set(String, Object)

Sets the variable to the specified value.

public:
 void Set(System::String ^ name, System::Object ^ value);
public:
 void Set(Platform::String ^ name, Platform::Object ^ value);
void Set(std::wstring const & name, winrt::Windows::Foundation::IInspectable const & value);
public void Set (string name, object value);
member this.Set : string * obj -> unit
Public Sub Set (name As String, value As Object)

Parameters

name
String

The name of the variable to be set. The name can contain drive and/or scope specifiers like "ENV:path" or "global:myvar".

value
Object

The value to set the variable to.

Exceptions

If the maximum number of variables has been reached for this scope.

If name is null.

If the variable is read-only or constant.

If the name refers to a provider that could not be found.

If the name refers to a drive that could not be found.

If the provider that the name refers to does not support this operation.

If the provider threw an exception.

Applies to