Article ID: 197425
Article Last Modified on 8/8/2007
Cscript \\<server>\<share>\RemoveIt.VBS //T:5 //BWhere <server> is the name of the server and <share> is the name of the share.
'-----------------------------------------------------------------------
' For Windows 95 Windows Script Host must be installed.
' The following VBScript sample will delete a file called Sample.txt and
' a folder called "Sample Folder" from the desktop.
' NOTE: To view the results of this script create a file called
' "Sample.txt" and a folder called "Sample Folder" on your desktop
' before you run the script.
' ----------------------------------------------------------------------
Dim WSHShell, DesktopPath
Set WSHShell = WScript.CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop")
' ON ERROR RESUME NEXT prevents error messages from appearing.
' Useful if the file or folder might have already been removed.
on error resume next
Icon = DesktopPath & "\sample.txt"
Folder = DesktopPath & "\sample folder"
Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.GetFile(Icon)
A.Delete
set B = fs.GetFolder(folder)
B.Delete
WScript.Quit
Additional query words: SCRIPT
Keywords: kbautomation kbhowto KB197425