On some file servers, users create multiple shotcuts pointing to different locations on the same server.
When migrating data from this server to another, these shorcuts are deprecated, so you need to update them and you can have thousands...
Here is a VB script that let you batch edit these shortcuts so that you can keep all of them updated.
Const srcServer = "\\formerServer\"
Const dstServer = "\\newServer\"
args = WScript.Arguments.Count
If args < 1 then
WScript.Echo "usage: cscript replaceLinkTarget.vbs [folder]"
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objFolder In objFSO.GetFolder(currentDrive).SubFolders
For Each objFile In objFolder.Files
If LCase(objFSO.GetExtensionName(objFile)) = "lnk" Then
Set objShell = CreateObject("WScript.Shell")
Set shortcut = objShell.CreateShortcut(objFile.path)
target = LCase(shortcut.TargetPath)
If (InStr(target, srcServer) > 0) Then
target = replace(target,srcServer,dstServer)
Wscript.Echo "New target : " & target
shortcut.TargetPath = target
If you can give a working script, that would be nice.ReplyDelete
For example I have a folder that I want to process all .lnk files in and run this against it
The script is now updated.
The previous version was incomplete. Sorry about that
I'm not sure if you will see this as your script was posted in 2011. I have server changing from one IP to another, and shortcuts were used for everything. A recent search showed over 10K lnk files that need to be updated. Your program script worked AWESOME! Thank you so much, you have no idea how much time it has saved me!!!!!!ReplyDelete
There are a great deal of content supplier that have given you several free web content that is prepared to utilize. You don't have to pay a software engineer or website admin to get an expert site. script readerReplyDelete