Friday, May 23, 2014

VB Script to delete User profile favorites folder and desktop shortcut

On Error Resume Next

Set oFso = CreateObject("Scripting.FileSystemObject")
set objShell=CreateObject("wscript.shell")
strTemp=objShell.ExpandEnvironmentStrings("%USERPROFILE%")
strFolder = strTemp & "\Favorites\MSN Websites"
strFolder1 = strTemp & "\Favorites\Windows Live"

set filesys=CreateObject("Scripting.FileSystemObject")

If filesys.FolderExists (strFolder) Then
filesys.DeleteFolder strFolder
End if

If filesys.FolderExists (strFolder1) Then
filesys.DeleteFolder strFolder1
End if

If oFso.FileExists("C:\Users\Public\Desktop\Skypetest.lnk") then
oFso.DeleteFile("C:\Users\Public\Desktop\Skypetest.lnk"), force
End If

No comments:

Post a Comment