Page 1 of 1 1
Topic Options
#110637 - 2003-12-19 03:54 PM change shortcut target
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
i need a script that will change the target of any .lnk pointing to a particular dir
i found a function on deleting .lnk pointing to a particular dir but i wanna change the target not delete the .lnk
also i ain't very good at functions (any good help topics on functions?)
cheers

Top
#110638 - 2003-12-19 04:14 PM Re: change shortcut target
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
there is EditShortcut() UDF that will edit a shortcut.

read the FAQ forum for some pointers
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#110639 - 2003-12-19 04:32 PM Re: change shortcut target
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
ok, got the editshortcut to work,
but what if a user has changed the name of the shortcut?
i suppose wildcard's ain't allowed?

Top
#110640 - 2003-12-19 04:37 PM Re: change shortcut target
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Then enumerate all shortcuts and evaluate each one to find the correct shortcut.
_________________________
There are two types of vessels, submarines and targets.

Top
#110641 - 2003-12-19 04:38 PM Re: change shortcut target
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you'll need to do a dir *.lnk on the folder and loop through each one
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#110642 - 2003-12-23 11:28 AM Re: change shortcut target
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
decided to use Lonkero's UNLINK function which works pretty well deleting the shortcut, then copy new shortcut's from the new location.
thanks again

Top
#110643 - 2003-12-23 03:12 PM Re: change shortcut target
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you have a central location with the updated .LNK files, then you could also do a XCOPY /D which will update all links on the target directory thatdon't have the same timestamp as the source directory. I would not even care whether the link is essentially the same or not, just copy based on timestamp.
_________________________
There are two types of vessels, submarines and targets.

Top
#110644 - 2003-12-23 07:26 PM Re: change shortcut target
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
But then you may want to disable link tracking as those links will contain the information from the machine they were located on and will try to contact that system when they run.

Just re-create the links on the fly and if users call saying their link (the one THEY renamed) doesn't work, tell them to delete that one and use the one your script created.

Top
#110645 - 2003-12-23 07:38 PM Re: change shortcut target
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, I do disable link-tracking by default in all links that point to network drives as I do not want my users to use UNCs.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 874 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.06 seconds in which 0.028 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org