I have a folder with over 500 shortcuts within. Each shortcut points to the same server but a different folder on the server. (We use an mrp system which runs the unique shortcut opening a folder.
I have just configured a new server and moved all the shortcuts over. I am looking for an automatic method to update the server name on the shortcut (Everything else remains the same).
I.e SHortcut path "\\Server01\Department\Product\ProductID1234" now becomes "\\Server02\Department\Product\ProductID1234"
Only change is 1 to 2. Is there any way of automatically doing ths.
Hi I've sussed it used ms-access and the following code......
Dim strDocPath As String
Dim strTarget As String
Dim obj As Object
Dim shortcut As Object
Dim objFso As Object
Dim objFolder As Object
Dim objFile As Object
Set obj = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder(strDocPath)
Set objFile = objFolder.Files
For Each objFile In objFolder.Files
If objFso.GetExtensionName(objFile.Path) = "lnk" Then
Set shortcut = obj.CreateShortcut(objFile.Path)
strTarget = shortcut.targetpath
strTarget = "\\server02" & Mid(strTarget, 13, 100)
strTarget = Trim(strTarget)
shortcut.targetpath = strTarget
'MsgBox (strTarget)
shortcut.Save
If strTarget = strDocPath & targetFolderName Then
Kill objFile.Path
End If
End If
Next
Set obj = Nothing
Set objFile = Nothing
Set objFso = Nothing
Set objFolder = Nothing
Set shortcut = Nothing
End Sub
Awesome, well I had just finished the Excel workbook too but as long as you have it figured out that's brilliant.
Status
Not open for further replies.
You have insufficient privileges to reply here.
Related Threads
?
?
?
?
?
Tech Support Guy
9.9M posts
859.7K members
Since 1998
A forum community dedicated to tech experts and enthusiasts. Come join the discussion about articles, computer security, Mac, Microsoft, Linux, hardware, networking, gaming, reviews, accessories, and more!