Hi There,
I have a bit of a challenge. I have a folder containing multiple subfolders and they all contain shortcuts. The shortcuts lead to a mapped networkdrive. at the moment this is U:\TAXLAWYER. this has to be changed for all shortcuts to U:\TAX
I already found a very nice script for this in another thread; http://forums.techguy.org/windows-xp...roperties.html
i changed this script to my (test) situation and it worked quite well except for 2 things
1) It only looks in de main folder, but not in its subfolders
2) it does change the 'target' but not the 'start in' portion of the .lnk file
The script contains 2 files. A .bat file and a .vbs file. These are as followed:
.bat
@Echo Off
Set _Path=C:\Test\kloet\wijzigen
Set _VBSPath=C:\Scripts
For /F "Tokens=* Delims=" %%I In ('Dir "%_Path%\*.lnk" /B') Do (
>>"%_Path%\LogFile.txt" cscript //nologo "%_VBSPath%\EditShort.vbs" "%_Path%" "%%~I"
)
.vbs
strPath = Wscript.arguments(0)
strLinkName = Wscript.arguments(1)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(strPath)
Set objFolderItem = objFolder.ParseName(strLinkName)
Set objShortcut = objFolderItem.GetLink
strOldPath = objShortcut.Path
strNewPath = Replace(strOldPath, "U:\TAXLAWYER", "U:\TAX",1,1,1)
If strOldPath <> strNewPath Then
Wscript.Echo "Shortcut Name " & strPath & "\" & strLinkName & vbCRLF & "Changed " & strOldPath & " to " & strNewPath & vbCRLF
objShortcut.Path = strNewPath
objShortcut.Save
End If
Can someone help me out with the 2 issues?
Greetings,
Lennart
I have a bit of a challenge. I have a folder containing multiple subfolders and they all contain shortcuts. The shortcuts lead to a mapped networkdrive. at the moment this is U:\TAXLAWYER. this has to be changed for all shortcuts to U:\TAX
I already found a very nice script for this in another thread; http://forums.techguy.org/windows-xp...roperties.html
i changed this script to my (test) situation and it worked quite well except for 2 things
1) It only looks in de main folder, but not in its subfolders
2) it does change the 'target' but not the 'start in' portion of the .lnk file
The script contains 2 files. A .bat file and a .vbs file. These are as followed:
.bat
@Echo Off
Set _Path=C:\Test\kloet\wijzigen
Set _VBSPath=C:\Scripts
For /F "Tokens=* Delims=" %%I In ('Dir "%_Path%\*.lnk" /B') Do (
>>"%_Path%\LogFile.txt" cscript //nologo "%_VBSPath%\EditShort.vbs" "%_Path%" "%%~I"
)
.vbs
strPath = Wscript.arguments(0)
strLinkName = Wscript.arguments(1)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(strPath)
Set objFolderItem = objFolder.ParseName(strLinkName)
Set objShortcut = objFolderItem.GetLink
strOldPath = objShortcut.Path
strNewPath = Replace(strOldPath, "U:\TAXLAWYER", "U:\TAX",1,1,1)
If strOldPath <> strNewPath Then
Wscript.Echo "Shortcut Name " & strPath & "\" & strLinkName & vbCRLF & "Changed " & strOldPath & " to " & strNewPath & vbCRLF
objShortcut.Path = strNewPath
objShortcut.Save
End If
Can someone help me out with the 2 issues?
Greetings,
Lennart