Windows shortcuts with relative paths

  • Thread starter Thread starter FirstName LastName
  • Start date Start date
F

FirstName LastName

I want to know if there is a way to create shortcuts with relative paths.

I already know that it isn't possible with normal windows shortcuts.

I've this folder tree:

\Program files\Folder Name\Folder Name\app.exe

The shortcuts must be in "\" or "\Shortcuts\"
 
FirstName said:
I want to know if there is a way to create shortcuts with relative paths.

I already know that it isn't possible with normal windows shortcuts.
You can use batch files.

From \:

@echo off
cd .\programs\irfanview
start i_view32.exe

From \shortcuts:

@echo off
cd ..\programs\irfanview
start i_view32.exe

If the name of the exe has spaces, put it in quotation marks.

Greetings,
Demetris
 
Demetris said:
You can use batch files.

From \:

@echo off
cd .\programs\irfanview
start i_view32.exe

From \shortcuts:

@echo off
cd ..\programs\irfanview
start i_view32.exe

If the name of the exe has spaces, put it in quotation marks.

Greetings,
Demetris

Thanks Demetris, that work.

I have another question. Everything in the "Windows" folder is runnable
from the run box. So writing "regedit" runs regedit. How can i give this
same ability to other folder. Running programs from the run box from
other folders.
 
Thanks Demetris, that work.

I have another question. Everything in the "Windows" folder is runnable
from the run box. So writing "regedit" runs regedit. How can i give this
same ability to other folder. Running programs from the run box from
other folders.

Add the directory to your path. In Win98 you simply use the path
statement in the autoexec.bat, I'm not sure how you would do it in
200/XP, I presume some registry hack would be required.
 
David wrote on 26 Mar 2006:
Add the directory to your path. In Win98 you simply use the path
statement in the autoexec.bat, I'm not sure how you would do it in
200/XP, I presume some registry hack would be required.

No, it's easy. Right click My Computer, Advanced, Environment
Variables, and then edit Path. Don't forget to separate entries with a
';'.
 
David wrote on 26 Mar 2006:


No, it's easy. Right click My Computer, Advanced, Environment
Variables, and then edit Path. Don't forget to separate entries with a
';'.

Thanks. I knew someone would know.
 
NickC said:
David wrote on 26 Mar 2006:


No, it's easy. Right click My Computer, Advanced, Environment
Variables, and then edit Path. Don't forget to separate entries with a
';'.

Thanks Nick.

But now I've another problem. The bat shortcut works from the from the
folder but not from the "Run" box.
 
Thanks Nick.

But now I've another problem. The bat shortcut works from the from the
folder but not from the "Run" box.

Does the .bat file actually change directory to the correct place for
the program? If the program is relying on its command line to give it
the location of files then you must either type the full path or
change to the directory before calling the program.
 
then the /windows stuff wont run from there

NT

Leave the /windows in the path and separate all entries with a
semicolon.

In Win 9x use

Path=%path%;newpath;secondpath;etc

to include the original path in the modified statement. It also pays
to use the 8.3 version of the directory names.

path=%path%;c:\progra~1\fred
 
David said:
Does the .bat file actually change directory to the correct place for
the program? If the program is relying on its command line to give it
the location of files then you must either type the full path or
change to the directory before calling the program.


This is the bat file

@echo off
cd ".\AUDIO\1by1 v1.44"
start 1by1.exe

when run from the run box it answers saying he cannot find "1by1.exe".

I don't want to write the full path. I need relative paths. For full
path I could have use the normal shortcuts.

I don't understand why it works when click but not when it's called from
the "run" box.

If I use the full path, either with .lnk or .bat, I will have to rename
the paths after I move the folder. Can I batch rename the path of .lnk
files. All of them in one go.
 
This is the bat file

@echo off
cd ".\AUDIO\1by1 v1.44"
start 1by1.exe

when run from the run box it answers saying he cannot find "1by1.exe".

I don't want to write the full path. I need relative paths. For full
path I could have use the normal shortcuts.

I don't understand why it works when click but not when it's called from
the "run" box.

If I use the full path, either with .lnk or .bat, I will have to rename
the paths after I move the folder. Can I batch rename the path of .lnk
files. All of them in one go.

Try this line CD "\AUDIO\1by1 v1.44"

I suspect the .\ is throwing you off. That would require the AUDIO
directory to be a subdirectory of the current directory whereas I
would suspect that it is either in the root directory or in the
"Program Files" or similar directory.

If AUDIO is dependent from the Program Files directory your line would
need to be:

CD "\ProgramFiles\AUDIO\1by1 v1.44"

A better line would be to put the full path of 1by1.exe in the START
line.

start "\ProgramFiles\AUDIO\1by1 v1.44\1by1.exe"

and delete the CD line. This would start 1by1 and you can open files
in the current directory.

You must remember that computers are stupid. They cannot read your
mind.
 
Back
Top