How to set up Environment Variables to help with Yubikey, GPG, and ykman.
These steps explain how to setup helpful Environment Variables that you can use to manage your keys and software.
Launch Command Prompt in administrator mode.
The Command Prompt -> SETX command is limited to 1024 characters.
If you have too many entries in your PATH environment variable, doing the commands below will cut off your paths. It's better to use the Powershell method.
BACKUP FIRST USING REGEDIT.
❊ Managing Environment Variables
BACKUP
Select only one method. It's highly recommended you use the regedit version. You can save the backup.reg file somewhere on your desktop and then execute it by double-clicking if you need to restore your original environment variables.
Once you have applied these new variables, you can open Command Prompt and type:
%gpglong%
%gpgshort%
To call these variables in Powershell, you need to call them a bit differently:
iex $env:gpglongiex $env:gpgshort
You can use your KEY_ID variables in commands by executing:
gpg --expert --edit-key %KEY_ID1%
gpg --expert --edit-key $env:KEY_ID1
❊ Command Prompt -> Set ENV -> Append
This is a list of commonly needed environment variables for this guide. Make sure you check the paths to ensure that yours are the same.
The following command can be used to append to your existing PATH.
The commands below will APPEND whatever is currently set for PATH and add the new path to the end of the line. Check the paths on these before you add them as your paths may be different: