You are here

The Easiest way to Create a Shortcut with Relative Paths

15 posts / 0 new
Last post
Wooops_Phil
Offline
Last seen: 14 years 3 months ago
Joined: 2009-06-18 23:25
The Easiest way to Create a Shortcut with Relative Paths

Since there´s no Tips & Tricks forum, I assume the better place to post may be here.

I´ve seen a lot of people asking how to create shortcuts with relative paths in windows, some say it´s just no supported etc etc At the end of the day there are several ways, like creating a windows shortcut files (.ink) or using a bat file wich can be converted to an exe with an icon file. Anyway non of both are ideal / have several disadvantages, so I´m going to share a method that works great for me and hopefully it may be useful for you as well.

  1. First we will need an Application called Portabilizer
    You can get it from here http://www.mystercrowley.com/portabilizer.php
  2. Now install it
  3. As you can see from this screenshot,
    http://www.mystercrowley.com/img/screenshots/portabilizer.png
    It´s a pretty straightforward app. OK, so we should now fill in the fields and here are some important details. After giving the name you want be sure to set a relative path in the launch target field i.e if your App exe is in E:\PortableApps\App.exe you may get something like \PortableApps\App.exe.
    What about if you want your shortuct to have a specific paramter, well then add the parameter in the "parameters" field but add an space before it, otherwise it may not work.
    For the last select the icon (it must be in .ico format) and the output folder. Note that the shortuct will only work if it´s being run from the same drive you have your App.exe
  4. Click in Start and you just did it! ^^ You have a nice exe shortcut with a custom icon and relative path

Note: You may notice that the newly created shortcuts have the name of the Portabilizer author on the organization field. Well in the unlikely case you may want to customize that as well, grab Resource Hacker Portable from here
http://www.angusj.com/resourcehacker/
Open the exe shortcut with it and go to the version info tab like in this picture
http://www.raymond.cc/images/hacking-windows-live-messenger.png (courtesy of Raymond.cc), make the changes you want, select compile script and you are set.

Cheers
Phil D.

John T. Haller
John T. Haller's picture
Online
Last seen: 56 min 37 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Doesn't Portablize

Portablizer doesn't actually portablize anything.

You can already do this in the PortableApps.com Menu by dropping an EXE in the right place on your drive. You can even do this with command line parameters and a custom icon just with a couple files in AppInfo, no 3rd party software required.

Sometimes, the impossible can become possible, if you're awesome!

Wooops_Phil
Offline
Last seen: 14 years 3 months ago
Joined: 2009-06-18 23:25
No it doesn´t

Portablizer doesn't actually portablize anything.

No it doesn´t, I´m just using it here for creating the shortcut.

You can already do this in the PortableApps.com Menu by dropping an EXE in the right place on your drive. You can even do this with command line parameters and a custom icon just with a couple files in AppInfo, no 3rd party software required.

Hum just realized that I didn´t expressed myself clearly in the title, I´m going to update it. The idea is for creating shortucts with relative paths, not for adding your app with realtive path to your PAM Menu. i.e I want different shortcuts that runs the same app with different parameters, wich in turn can be added to PAM´s Menu, but that´s another story.

solanus
solanus's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2006-01-21 19:12
If you don't want the shortcut in the PA Menu

Use Cylog Toolbox. The latest beta is stable, supports relative paths, is natively portable, supports a custom "Open With...", supports command-line parameters, supports drag-and-drop, supports different image types for icons, yadayada, it's da bomb.
http://www.cylog.org/utilities/toolbox_beta.jsp
If you don't like betas, I'm pretty sure the stable version supports all of the above, too.
And it's free.
And it's portable.

I made this half-pony, half-monkey monster to please you.

poogie
Offline
Last seen: 13 years 7 months ago
Joined: 2010-09-10 09:23
Nice!

Hey,it's nice,that's what i was looking for.
Good for running as administrator with relative path shortcuts.
Tested OK
Smile

solanus
solanus's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2006-01-21 19:12
You really DON'T need an exe

It's actually very easy to make a shortcut on the PAM to a batch file directly, without using bat2exe or any other conversion utility.

Create the PA Format folder structure, and create a simple
...App\Appinfo\Appinfo.ini file, and an appicon.ico

You can configure the relative path to the batch file (or any other file) in the [Control] section.

The icon will appear in the menu and activate whatever is on that relative path.

There's a little more detail than that, but not much.

I made this half-pony, half-monkey monster to please you.

lwc
Offline
Last seen: 3 days 14 hours ago
Translator
Joined: 2006-04-26 06:35
Or use Relative

It's much easier to just use the portable freeware Relative. Alas, it's a command line utility so it's not meant for newbies.

ottosykora
Offline
Last seen: 2 weeks 2 days ago
Joined: 2007-10-11 17:48
not much of portable

since this need to be placed in position within the windows env variable PATH, so need to be copied to the host system to proper place first.

Otto Sykora
Basel, Switzerland

lwc
Offline
Last seen: 3 days 14 hours ago
Translator
Joined: 2006-04-26 06:35
It's just a random suggestion

It's true for any portable command line program. You can also just call it from its own folder every time.

Ed_P
Offline
Last seen: 5 years 6 months ago
Joined: 2007-02-19 09:09
Not really necessary

If you know the location of the app you can specify it's path when running it without modifying the PATH variable. Or create a short cmd script to reduce the typing.

Ed

Ed_P
Offline
Last seen: 5 years 6 months ago
Joined: 2007-02-19 09:09
Not really necessary

If you know the location of the app you can specify it's path when running it without modifying the PATH variable. Or create a short cmd script to reduce the typing.

Ed

lwc
Offline
Last seen: 3 days 14 hours ago
Translator
Joined: 2006-04-26 06:35
Argh, it's not supported in Windows 7!

The same relative shortcuts that work in Windows XP fail in Windows 7 (and probably in Windows Vista as well).

This means this topic needs a different solution.

solanus
solanus's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2006-01-21 19:12
Check this out

These are examples of what I was talking about.
The first is a way to make shortcuts to folders. ALL IT IS is a simplified PA Format folder structure. The only files are the appinfo.ini and appicon.ico files - although I added a help file too. Since appinfo.ini supports relative paths, you just need to put in the correct path in the [Control] section of appinfo.ini.
You can also put relative paths to programs - they will function with the typical file associations of Windows.
All I did was package it as a .paf.exe file.**
http://paskins.sourceforge.net/miniapps.html#Folderz

This second is basically the same, but includes a batch file, which starts two apps simultaneously. It's a pretty good example of how you can directly start a batch file, and how batch files support relative paths.
http://paskins.sourceforge.net/miniapps.html#Quickstart

So simply, if you are using the PortableApps Platform, you can make shortcuts to almost anything WITHOUT any additional apps.
You don't need an exe to start a batch AT ALL!
You don't need to do anything with the PATH!
Just the appinfo.ini.

** If you want to do it manually, it is simplicity itself.
Look here: https://portableapps.com/node/20498

I made this half-pony, half-monkey monster to please you.

iri
Offline
Last seen: 13 years 5 months ago
Joined: 2010-11-19 07:36
Or ... check this out !!

the easiest way to make real windows shortcuts (lnk, not exe cmd files) in automated way

small program to be launched from command line, that makes shortcut of a specified file

http://www.xxcopy.com/xxcopy38.htm

the syntax is very simple:

xxmklink [the path and name of shortcut to be created] [the path to the program/file] [arguments for program to run, in double quotes, if no arguments put ""] [path to working directory (start in)]

...and it's done

use switch /q for no output messages, use double quotes for paths and names with spaces between, use system variable path or relative path if need

lwc
Offline
Last seen: 3 days 14 hours ago
Translator
Joined: 2006-04-26 06:35
How is this related (no pun intended)?

This is a topic about shortcuts with relative folders. The program you linked to ("XXMKLINK") has nothing to do with this. It's a regular shortcut maker, unlike the aforementioned "Relative" program.

As a side note, XXMKLINK does support "%path%"s which is better than Windows' shortcut maker. But it's neither relative nor actually works (such links are broken at least in Windows XP).

Log in or register to post comments