This article introduces how to launch and open the Windows environment variables settings from command line, cmd.exe or powershell.
While it’s known that environment variables can be set from the command line like $ENV:PATH="$ENV:PATH;c:\path\to\folder", this is prone to mistakes. That thing.
Apart from Ubuntu, I’m not good at Windows environment variable settings. Just trying to manually set environment variables… is painful.
The reason is that opening the window every time is tedious.
Here’s a script to open that window from command, cmd or powershell.
Start C:\Windows\system32\rundll32.exe sysdm.cpl, EditEnvironmentVariables
「環境変数」ウィンドウを直接開くバッチファイル - Corredor
Typing this every time is too tedious, so I create an alias.
# # Confirm the command is not defined.
PS C:\pg\sinatra> gcm path
gcm : The term 'path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ gcm path
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (path:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
# # Define alias
PS C:\pg\sinatra> New-BashStyleAlias path "Start C:\Windows\system32\rundll32.exe sysdm.cpl, EditEnvironmentVariables"
Now you can open the window with path.
Just copy and paste this into $PROFILE and load it on startup to make it ok.
By the way, I wonder how to find out the arguments for rundll32.exe windows… I looked for such a tool before but couldn’t find one. So far, I’ve been searching for things like proxy and this one by one to find them… Is there anything good?