Long established Set-* cmdlets such as Set-Variable and Set-Alias have creation on demand logic.
For instance, Set-Variable NoSuchVarYet NewValue creates $NoSuchVarYet if it doesn't exist yet.
By contrast, Set-EnvironmentVariable only succeeds if the target environment variable already exists.
Long established
Set-*cmdlets such asSet-VariableandSet-Aliashave creation on demand logic.For instance,
Set-Variable NoSuchVarYet NewValuecreates$NoSuchVarYetif it doesn't exist yet.By contrast,
Set-EnvironmentVariableonly succeeds if the target environment variable already exists.