Name: cobyurl3 Date: October 11, 2007 at 07:54:26 Pacific Subject: VBScript File search OS: XP CPU/Ram: 2.8/1GB Model/Manufacturer: IBM THinkcentre
Comment:
I need a VBScript to a shortcut on any user's desktop by it's URL or Targetpath only. Different users call the same shortcut different things. we want to find the shortcut and delete it. Anybody have any ideas, thanks.
The problem, as I see it, is VBS, which has no way of interacting with shortcuts, outside of creating them. Therefore, we must test the file for the string we're looking for, which may or may not return anything meaningful. (Note: If this is something on a network drive, leave off the share name and/or the mapped drive letter.)
For Each file In oFSO.GetFolder(sDesktop).Files If BCheckFile(file) Then file.Delete Next
Function BCheckFile(oFile) BCheckFile = False Dim sShortcut sShortcut = oFile.OpenAsTextStream(1, 0).ReadAll _ & oFile.OpenAsTextStream(1, -1).ReadAll If InStr(1, sShortCut, sLookFor, 1) Then _ BCheckFile = True End Function
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE