Getting to Environment Variables Fast

I tend to keep connection strings, security tokens, and other secrets in the environment variable. This is handy when you commit your code to a public repository and want to make sure that your storage account connection string is not shared worldwide. It's also convenient because all those variables can be accessed in almost any hosting environment (VM, Cloud Service, WebJob, Azure Function, you name it). The downside - getting to those environment variables fast to modify those.

Usually, I'd be doing Computer --> Properties --> Advanced System Properties to get where I need. When RDPed into a VM or a Cloud Service instance that's just slow. Luckily, there's a way to get to the same place much faster.

Win-R (to open a run command window)
sysdm.cpl ,3

And done. Works like a charm. No more clicks and navigates in a slow worker role instance. Happy fast environment variables editing!

3 Comments

  • Nice! :D

  • Now that Windows Server 2016 and Server Core are things, one might hope that there would be a powershell way to do this. Say, this, to get it:

    Get-ChildItem Env:

    And this to set it:

    [Environment]::SetEnvironmentVariable("VAR", "VALUE", "USERNAME")

    Perhaps restarting processes/services might be required to get those changes into the processes. Just like changing your path in the control panel won't take effect until you start a new command prompt.

  • @Warren,
    would be nice. If it would support environment scope, you could scope it to the user level and no process restart would be needed.

Comments have been disabled for this content.