Tech Support Guy banner
Status
Not open for further replies.

Repointing multiple ShortCuts

Solved 
676 views 4 replies 2 participants last post by  DataBase 
#1 ·
Hi

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.

Thanks
 
#2 ·
This is possible, I can try creating something in Excel VBA which can change the target of each shortcut to the new target.

Will all the shortcuts be "\\Server02\Department\Product\ProductID1234"

or (and I assume this will be the case) they will all be different and you just need to change server 1 to server 2??

this may take a little longer but still can be achieved. Give me a little while i'll try getting something over by tomorrow
 
#4 ·
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")

strDocPath = targetFolderName 'compName & recordDirShort

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
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top