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
More Related Contents:
- How to run a PowerShell script without displaying a window?
- How to run a PowerShell script
- How to run a PowerShell script within a Windows batch file
- How do I get the current username in Windows PowerShell?
- Powershell: What’s the difference between Alias and Function?
- How to delete subfolders and Files but not parent Folder in windows using Script? [closed]
- How can you find and replace text in a file using the Windows command-line environment?
- Running PowerShell in Task Scheduler
- FORFILES date -after- (date calc in cmd file)
- Is there replacement for cat on Windows
- How to create batch file in Windows using “start” with a path and command with spaces
- Capture program stdout and stderr to separate variables
- Running cURL on 64 bit Windows
- Decode PowerShell output possibly containing non-ASCII Unicode characters into a Python string
- How do you successfully change execution policy and enable execution of PowerShell scripts
- Which version of MSXML should I use?
- How can I run a windows batch file but hide the command window?
- “Firebase cannot be loading because running scripts is disabled on this system”, VSCode on Windows
- Cannot remove item, The Directory is not empty
- PowerShell stripping double quotes from command line arguments
- Start a detached background process in PowerShell
- Cannot run Maven using `mvn -D` argument within Microsoft Powershell, but works in Command Prompt
- Alternative to Win32_Product?
- How to add more than one machine to the trusted hosts list using winrm
- Powershell Add System Variable
- Can we see the source code for PowerShell cmdlets?
- Powershell script does not run via Scheduled Tasks
- How can I source variables from a .bat file into a PowerShell script?
- Adding path permanently to windows using powershell doesn’t appear to work
- How to expand a CMD shell variable twice (recursively)