How to create relative shortcut to .exe file with icon?

One year ago I encountered a problem relevant to create a shortcut for relative path. I had to deliver a software package to customers over DVD. The app is kind of archive. It should run live on DVD, connect to a read-only SQLite database (also on that DVD) and display data in read-only mode. It’s pretty easy to deploy such software but when I copy files into a sub folder and create a shortcut to program on its parent folder. The shortcut won’t work on other machine because it uses absolute path and the icon won’t also appear. So a consideration raised if I should develop a Start.exe just to start the program or use some tricks to create a same thing.

Making a Start.exe with C# or any programming language is easy but in this post I would like to show you another way to make an .exe file from .bat file. The advantage of this method is no programming knowledge required. All you need is just click and click.

1. Use case

For example, we want to create a shortcut to our program with relative path like image below


Because Windows does not support relative paths in shortcuts, we have to make a trick by creating a batch (.bat) file and converting it to an executable (.exe) file. This new created .exe file will serve as shortcut to our program.

2. Solution

1. Open Notepad or any text editor and enter the relative path to your app from location where you want to put your shortcut. Then save file with .bat extension, for example “YourShortcut.bat”.

Notepad and relative path

NOTE: Don’t forget to surround the path with quotes and use backslash for full path value.

2. Download Bat To Exe Converter from one of following mirrors

Mirror 1:
Mirror 2:
Mirror 3:!7hAyzbZa!09fniRVlhzJFxgb6_TtwtYRjo5ACBbxBHkdp9wY9J5g

NOTE: You don’t have to install the software. Just extract .zip file, go to Portable and start the version corresponding to your OS (such as 32/64 bit).

3. Browse to our .bat file. In Options –> Visibility group, set to Invisible application

Select .bat file

4. Under Version information –> Icon file, select your .ico file

Select .ico file

NOTE: There are also another options for new created .exe file such as password protection, run as administrator (Add administrator manifest) or Compress the exe using UPX. For Architecture, I recommend let as default 32 Bit so that our shortcut can run under any platform.

Under Include we can also include more files to created one. All of included files will be extracted on same directory of .exe file when it runs. If your .bat file requires resources (for example 3rd components), you can include them also in this section.

5. Click Compile when you finish. At output folder, you’ll get new created .exe file

New .exe file

6. This file can be used as a Start.exe or as a shortcut to your program. It works with relative path. What is still missing is the tiny shortcut icon on left under corner. You can take one free from this link

Make this overlay over your real icon and you’ll get same effect as it is a shortcut icon. For example, these are 2 small icon files with shortcut effect : Sample overlay shortcut 1 Sample overlay shortcut 2

3. Conclusion

It’s pretty easy for a software engineer to write a Start.exe and fake it as a shortcut. As a normal user, you can follow instructions above to create a same thing without writing any code row. Which one you prefer, is always your choice. ;).

1 comment

  1. It only worked for me when I set it to visible application and no icon. After it compiled the working exe, I used Resource Hacker to add the icon.

Leave a comment

Your email address will not be published. Required fields are marked *