# dynamically changing link / shortcut location?

Posted: 01-19-2009, 04:59 PM
Hello,
Is there a way to dynamically change the location of a shortcut?
Here is my issue:
I have a network folder: \\server\share\test

in the test folder I have Application1.exe and Shortcut to
application1

I copy the test folder from the \\server\share to C:\Program Files

so now I have a C:\Program Files\test folder
the thing is, the shortcut to application1 still point to \\server
\share\test

Is there a way to dynamically change this so when I move it to another
location, the shortcut changes?

so the shortcut should be: C:\Program Files\test

Any ideas? is this possible?
I am copying this folder via a batch script to 50+ computers and this
would make things much easier

thanks.

## dynamically changing link / shortcut location?

### Responses to "dynamically changing link / shortcut location?"

Tom Lavedas
Guest
Posts: n/a

Re: dynamically changing link / shortcut location?
Posted: 01-19-2009, 05:34 PM
On Jan 19, 11:59*am, Paul <paul...@excite.com> wrote:
> Hello,
> Is there a way to dynamically change the location of a shortcut?
> Here is my issue:
> I have a network folder: \\server\share\test
>
> in the test folder I have Application1.exe and Shortcut to
> application1
>
> I copy the test folder from the \\server\share *to C:\Program Files
>
> so now I have a C:\Program Files\test *folder
> the thing is, the shortcut to application1 still point to \\server
> \share\test
>
> Is there a way to dynamically change this so when I move it to another
> location, the shortcut changes?
>
> so the shortcut should be: C:\Program Files\test
>
> Any ideas? is this possible?
> I am copying this folder via a batch script to 50+ computers and this
> would make things much easier
>
> thanks.
The shortcut can easily be modified, or created for that matter, using
the Wscript.Shell CreateShortcut object. Note that the name is
misleading in that it can be used to modify an existing shortcut's
properties as well as creating them in the first place.

For example, from the WSH documentation (slightly modified VBS
version) ...

set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
"\Shortcut Example.lnk")
Path ONLY
oShellLink.WorkingDirectory = strDesktop ' or wherever

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
ten.nigriv@virgin.net
Guest
Posts: n/a

Re: dynamically changing link / shortcut location?
Posted: 01-19-2009, 06:51 PM
On Mon, 19 Jan 2009 08:59:47 -0800 (PST), Paul wrote:
> Hello,
> Is there a way to dynamically change the location of a shortcut?
> Here is my issue:
> I have a network folder: \\server\share\test
>
> in the test folder I have Application1.exe and Shortcut to
> application1
>
> I copy the test folder from the \\server\share to C:\Program Files
>
> so now I have a C:\Program Files\test folder
> the thing is, the shortcut to application1 still point to \\server
> \share\test
>
> Is there a way to dynamically change this so when I move it to another
> location, the shortcut changes?
>
> so the shortcut should be: C:\Program Files\test
>
> Any ideas? is this possible?
> I am copying this folder via a batch script to 50+ computers and this
> would make things much easier
>
> thanks.
Two things initially spring to mind.
Firstly, why not just create the shortcut to '%ProgramFiles%\test' in the
first place. If you are deploying this to multiple PC's then those PC's
will likely be receiving the copies of 'test' directory in the same
locations!
Secondly, where is the shortcut going?. There is little no point in having
a shortcut located inside a %ProgramFiles% directory if that is also the
location of the target!. Even if the shortcut has additional parameters
required to run the target, which would be the only purpose in them being
in the same location, that location is not easily reachable for your users
to easily invoke it.
John Gray
Guest
Posts: n/a

Re: dynamically changing link / shortcut location?
Posted: 01-19-2009, 07:31 PM
On 19 Jan, 16:59, Paul <paul...@excite.com> wrote:
> Hello,
> Is there a way to dynamically change the location of a shortcut?
> Here is my issue:
> I have a network folder: \\server\share\test
>
> in the test folder I have Application1.exe and Shortcut to
> application1
>
> I copy the test folder from the \\server\share *to C:\Program Files
>
> so now I have a C:\Program Files\test *folder
> the thing is, the shortcut to application1 still point to \\server
> \share\test
>
> Is there a way to dynamically change this so when I move it to another
> location, the shortcut changes?
>
> so the shortcut should be: C:\Program Files\test
>
> Any ideas? is this possible?
> I am copying this folder via a batch script to 50+ computers and this
> would make things much easier
>
> thanks.
Have a look at Marty List's Shortcut utility