Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Lets say the following windows file-structure is given:

./
./portable_chrome.exe
./index.html
./load_index.lnk

Is there a way to open the index.html with portable_chrome.exe via load_index.lnk with relative adressing? (not via file:///)

Thanks for an answer!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

.LNK is a shortcut file, not an NTFS soft symbolic link. The former can contain an editable Target field where you can add parameters, not the latter.

You can try creating a shortcut to portable_chrome.exe and in the Target field add index.html to it, so that it looks like "Drive:\Path\to\portable_chrome.exe" index.html. While shortcuts cannot contain relative paths, launching them will cause them to auto-resolve so in this case whatever be the path portable_chrome.exe should be located and used since it exists in the same directory as the shortcut itself.

Alternately, you can create a one-liner Launch.bat batch file in the same directory with portable_chrome.exe index.html in it.

share|improve this answer
    
Thanks, I wrote a script, I was just curious whether its possible or not –  fma Dec 14 '12 at 7:28
    
While shortcuts cannot contain relative paths… They cannot contain relative paths for the program (what exactly would they be relative to anyway, the location of the shortcut file? the current directory when it is launched?), however they can indeed have relative paths for command-line arguments because Explorer does not parse arguments and therefore does not distinguish parameters that are paths. It simply appends arguments to the command in the shortcut as-is. It is the program that parses them, converting any relative paths relative to the location specified in the Start In field. –  Synetech Dec 15 '12 at 6:14
    
@Synetech: I guess I thought it was obvious I was referring to relative paths for the very thing the shortcut is pointing to, but maybe I wasn't clear enough. Of course you can tag on anything as an argument, even a relative path, and it's the program's responsibility to deal with it. (Also, I'd love to create relative shortcuts, especially on removable read-only media that ends up with different drive letters every time.) –  Karan Dec 16 '12 at 12:41
    
I was referring to relative paths for the very thing the shortcut is pointing to But the question is asking about relative paths for the arguments. I'd love to create relative shortcuts, especially on removable read-only media that ends up with different drive letters every time. Indeed. Unfortunately the closest we can get is to use a batch file (making sure to use start so that the console is closed after launching the program). –  Synetech Dec 16 '12 at 16:12
    
@Synetech: "But the question is asking about relative paths for the arguments." As I mentioned above "Drive:\Path\to\portable_chrome.exe" index.html will work and one need not even specify a path to the HTML file as long as it resides in the same dir as the portable Chrome EXE (which it does as per the question). However due to the limitations of shortcuts a batch file is the best solution, and I think we agree on that point. –  Karan Dec 16 '12 at 16:21

No. Normally most browsers will display the full local path (file://)

share|improve this answer
    
I think you missed the point of the question completely. The OP's not asking about the file path/URI displayed in the browser's address bar. –  Karan Dec 13 '12 at 23:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.