Find and replace drive letter for shortcuts?

  • Thread starter Thread starter boe
  • Start date Start date
B

boe

I have several systems which I am putting a second hard drive. Each of
which has about 25 shortcuts currently pointing to their old location on the
C: drive. Are there any good tools for replacing the C:\ to d:\ ?
 
boe said:
I have several systems which I am putting a second hard drive. Each of
which has about 25 shortcuts currently pointing to their old location on the
C: drive. Are there any good tools for replacing the C:\ to d:\ ?
Hi

You could use WSH's Scripting.FileSystemObject to enumerate all the .lnk
files in a folder, and then use the CreateShortcut method to get to
the TargetPath property of the shortcut.

From the Windows Script Host docs:
CreateShortcut Method: Creates a new shortcut, or opens an existing shortcut.

You can point to the existing shortcut with the CreateShortcut method,
and then you can read and/or modify it's properties.


Some code examples:

Subject: Reading the Target of a Shortcut
http://groups.google.co.uk/groups?th=42390a09fb7ff557

Subject: Re: Script to replace destination on shortcut icon
http://groups.google.co.uk/[email protected]

Subject: Re: Copying files behind links
http://groups.google.co.uk/[email protected]


WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
 
Thanks

Torgeir Bakken (MVP) said:
Hi

You could use WSH's Scripting.FileSystemObject to enumerate all the .lnk
files in a folder, and then use the CreateShortcut method to get to
the TargetPath property of the shortcut.

From the Windows Script Host docs:
CreateShortcut Method: Creates a new shortcut, or opens an existing
shortcut.

You can point to the existing shortcut with the CreateShortcut method,
and then you can read and/or modify it's properties.


Some code examples:

Subject: Reading the Target of a Shortcut
http://groups.google.co.uk/groups?th=42390a09fb7ff557

Subject: Re: Script to replace destination on shortcut icon
http://groups.google.co.uk/[email protected]

Subject: Re: Copying files behind links
http://groups.google.co.uk/[email protected]


WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
 
Back
Top