![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Microsoft Windows xp error all errors and bugs related to Microsoft winxp error |
![]() |
|
Creating a dynamic shortcut
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 18,712
Join Date: Jan 2006
Rep Power: 10
IM:
|
I have an external hard drive which occasionnally has a different letter assigned. I have a shortcut in the root of the HDD which of course does not work if the letter assingment changes. Instead of simply re-assigning the letter each time, is there a way to create a shortcut that finds out the letter assigned to the HDD and then open the required program. For example instead of H:\Program1 it would be (FIND ROOT):\Program1, is this possible ? Solution Absolute path unambiguously defines a unique location with in the system no matter where it is use from. If you are in C:\folder1 then cd F:\folder1\folder2\program1 specifies a unqiue executable no matter where you may be in your file system. Relative path is a path which is relative to your current location .. (dot dot) refers to parent directory. so ..\Folder1\program1 might mean different things depending on what your current directory is. >Do I simply create a shortcut and for the target type "..\Folder1\Program1" No .. you cannot specify relative path in shortcut. Create a batch file instead. This batch file can use a relative path. You can launch this batch file whenever you need to launch your program. |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Fix my Error!
Posts: 1
Join Date: Feb 2008
Rep Power: 0
IM:
|
Suppose that you have file start.exe in folder '\Program' (subfolder from the root) on drive d: and you want to make shortcut so that works on any odher drive. Right click on the file start.exe and choose "create shortcut". Move that shortcut in the root, moreover you may rename it if you want (start.lnk for example). Notice the size of the file start.lnk. Now, double-click on start.lnk to run start.exe. Program will, naturally, start because the shortcut refers to absolute location (path) of the start.exe. Now, rename folder "Program' in any another name, for example 'New'. Click on start.lnk. Amazingly, start.exe starts again. What happened? Look at start.lnk (right click, properties) - now, it points to new location od start.exe in folder 'New'. It means that Windows "intelligently" managed shortcut and found it in new location 'New' and changed path in the shortcut start.lnk. The size of the file start.lnk changed (naturally, because the location have changed also). But now, rename folder 'New' again in 'Program'. Click agan start.lnk, start.exe will run again, and the path in start.lnk is again changed in the original one. Look at the size of the file start.lnk. It's not the same as it initially was. And not only it's not the same size, now it allocates file start.exe "dynamically". If you move both the start.lnk and 'Program' folder in any other location on any other drive (don't forget to erase it from the original location to be sure that all this work), you will always run program by clicking start.lnk. If you move the shortcut and program folder on another location before you start it via shortcut in original location, Windows will not be able to find it. Only if you start it via shortcut on initial location, and start it again after renaming folder, Windows will be able to find it and, in certain way, "dinamically" allocate program inside the shortcut and find it later regardless of the new location ond new drive. What really happens, I don't know, but it will work not only in Windows XP, it will work in Windows 98 also (I didn't try it in older versions) |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|