Path Shortcuts – Shortcuts Without a Shortcut File
What
Instructions to create Path shortcuts (also known as Environment Variables) which do not have a file for the shortcut and no shortcut icon on the Desktop or anywhere in Windows.
Why
Users have some folders that they go to quite often and have created shortcuts to open these folders in File Explorer directly making it easy to access these folders. However, when they try to access those folders from an open or close window of an app, they can’t use the shortcuts they made and have to click thru File Explorer to get to the folder they want. You can create a Path shortcut that can be entered in the address bar in File Explorer’s open/close windows and go directly to that folder. Path shortcuts can also be used in the Run box, CMD, .bat, and script files to save entering long (easy to enter wrongly) Path addresses. The following instructions explains how to create your own personal Path shortcuts.
Note: These instructions have been tested in Windows 7 and 10, but should also work in other versions.
How
Background:
A Path shortcut, which Windows calls an Environment Variable, is a group of letters that represent a specific Path address such as this:
APPDATA = “C:\Users\Username\AppData\Roaming”
(replace your account name for Username)
To use a Path shortcut you must place percent (%) signs before and after the Path shortcut such as %APPDATA%.
Path shortcuts work anywhere a Path address is entered such as Run box, CMD, PowerShell, File Explorer address bar including the open and close Explorer windows, and script files. Thus %APPDATA% entered into a Run box will open File Explorer to C:\User\Username\AppData\Roaming folder.
The Path shortcut can be part of a longer Path address such as %APPDATA%\Microsoft\Templates which opens the Office templates folder which is easier to enter than C:\Users\Username\AppData\Roaming\Microsoft\Templates.
The case of the Path shortcut letters when entered makes no difference. %appdata% works just like %APPDATA%. Also the Path shortcut will open and display the folder or file of the shortcut even if it is in a hidden folder and File Explorer is set to not show hidden folders and files.
Create a Path Shortcut
- Rather than typing the Path address to the folder for the Path shortcut it is best to go to the folder in File Explorer and have Windows copy the Path address to that folder. Open File Explorer and go to the folder you want the Path shortcut to. Don’t open the folder, just select and highlight the folder. On the Home tab click the Copy path icon to copy the Path to that folder.
- The Path shortcut is created with a command in an Administrator Command window.
- Open an Administrator Command window by opening a Run box (WinKey +R), entering cmd, press Ctrl + Shift + Enter keys at the same time, and OK the UAC query box that opens.
- The command to create a Path shortcut is:
setx_ShortcutName_Path address to the folder or file
The _ indicates where a space is placed in the command
ShortcutName is the name you select for the Path shortcut
Path address to the folder or file is the full Path address to the folder or file the Path shortcut is for. This Path address should be in quotation marks,
- As an example I will create a Path shortcut named TEMPLATES for the folder that Microsoft Office stores templates (C:\Users\Username\AppData\Roaming\Microsoft\Templates), which I copied the Path to (your user name replaces Username).
- Following my example, at the prompt enter setx followed by a space, enter TEMPLATES followed by a space, right click the mouse to paste the Path address you copied earlier. The command would look like this
setx TEMPLATES “C:\Users\Username\AppData\Roaming\Microsoft\Templates”
- Press the Enter key and the command will run and reply SUCCESS: Specified value was saved.
- Open a Run box and enter %TEMPLATES% and press the Enter key and C:\Users\Username\AppData\Roaming\Microsoft\Templates folder will open.
- Replace TEMPLATES with your shortcut name. Keep the name short (you will be typing it) and no spaces in the name, and replace the Path address with the Path address to your file or folder.
- You can have functional shortcuts that don’t take up Desktop space with a shortcut file and icon.
- If you wish to see a list of your Path shortcuts, each with the Path address they are the shortcut for, at the prompt of that Administrator Command window enter
set
and press the Enter key.
Comments
- These Path shortcuts makes writing bat and script files much easier.
- These work great with the Run box to open files and folders because the Run box has a recent used list and after entering the Path shortcut I usually don’t have to enter it again and just select it from the recent Run Box list (AKA: a list of shortcuts to choose from).
HTH, Dana:))