Search code examples
windowsbatch-filecmdenvironment-variablesappdata

How to create a custom percent (%) shortcut like %appdata%?


Is it possible? If so, how? Can it be done in CMD?

Existing shortcuts examples :

%appdata%
%temp%
%userprofile%

Solution

  • These are environment variables and you can set your own, yes.

    You can set them within a script or at cmd prompt with set, and you can make "global" environment variables by going to System Properties/Advanced and clicking the Environment Variables button. Variables added there will be available to all applications. If you have existing cmd windows open, though, they won't get the global variables - you will need to open new windows to make these variables available.