PowerShell: Setting an environment variable for a single command only
PowerShell: Setting an environment variable for a single command only
PowerShell: Setting an environment variable for a single command only
Re: PowerShell: Setting an environment variable for a single command only
Generally, it would be better to pass info to the script via a parameter rather than a
global (environment) variable. But if that is what you need to do you can do it this way:
```
$env:FOO = 'BAR'; ./myscript
```
The environment variable $env:FOO can be deleted later like so:
```
Remove-Item Env:\FOO
```
global (environment) variable. But if that is what you need to do you can do it this way:
```
$env:FOO = 'BAR'; ./myscript
```
The environment variable $env:FOO can be deleted later like so:
```
Remove-Item Env:\FOO
```