Site icon SumTips

How to Create Portable Shortcut with Relative Path in Windows

Windows does not support relative paths in shortcuts. So, if you work on multiple computers and carry portable programs in a flash drive, you’ll have to launch each program by going inside its respective folder. HowToGeek.com has showed a solution to this problem by creating a batch (.bat) file and then converting it to an executable (.exe) file. That involves a lot of work.

In this post I will show you a simple way to create a portable shortcut with relative paths using the standard Windows shortcut creating wizard. Here are the steps:

  1. Create a new shortcut using Create Shortcut Wizard (right-click > Shortcut).
  2. In the field that asks you to enter the item’s location, enter: explorer.exe
  3. For name, provide the program (or file) name for which you are creating the shortcut, then hit Finish.
  4. Now, right-click on the new shortcut and select “Properties”.
  5. Under the “Shortcut” tab delete “C:\Windows” in “Start in” field to make it blank. This ensures that the shortcut will start in its current path.
  6. In Target field add this: %windir%\explorer.exe. Following it, add the relative path to your program in double-quotes. For example, %windir%\explorer.exe "\your\folder\app.exe” or %windir%\explorer.exe "..\my\files"
  7. If you want, replace the shortcut icon for whatever icon you prefer. But make sure it’s something from %SystemRoot%\system32\SHELL32.dll. Relative-path trick doesn’t work in shortcut field.
  8. Click OK to close thhe Properties window.
  9. Place the new shortcut in its proper location (perhaps at the root folder of your USB drive).

That’s it. Try the shortcut now; it should open the application/file you want.

Instead of using a shortcut you could also create a batch file that uses a root relative path to the EXE file. For example,

@start "" "\Portable\App-name\app.exe"

The batch file should then work on any computer from anywhere on the flash drive, whatever the drive letter.

This tip has been tested and found working on Windows 8 and Windows 7, but should do so in other Windows versions as well.

Exit mobile version