Last active
April 12, 2021 19:42
-
-
Save manoj-choudhari-git/98f0601245ed3a28e3730db36bd9e10d to your computer and use it in GitHub Desktop.
Commands to set ASPNETCORE_ENVIRONMENT value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Windows Command Prompt using setx.exe | |
## Temporary, for current session | |
## When session is closed, value is lost | |
set ASPNETCORE_ENVIRONMENT "Test" | |
## Permenant, for current user, set user level | |
setx ASPNETCORE_ENVIRONMENT "Test" | |
## Permenant, for all users, set machine level | |
setx ASPNETCORE_ENVIRONMENT "Test" /M | |
# PowerShell | |
## Temporary, for current session | |
## When session is closed, value is lost | |
$Env:ASPNETCORE_ENVIRONMENT = "Test" | |
## PowerShell Script to get both key and value | |
Get-Item -path Env:ASPNETCORE_ENVIRONMENT | |
## PowerShell script to get the value | |
Get-Content -Path Env:ASPNETCORE_ENVIRONMENT | |
## PowerShell to set the value | |
Set-Content -Path Env:ASPNETCORE_ENVIRONMENT -Value "Test" | |
# PowerShell: Using System.Environment class | |
[Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Security", "User") | |
[Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Security", "Machine") | |
# MacOS | |
export ASPNETCORE_ENVIRONMENT=Staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment