I was wondering if there is a way to make it so my vbs script can check for and delete any files with a certain word in it's name. This is what I have so far:
x=MsgBox ("Searching for any infected files...",64,"Search")
DIM filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("C:\Documents and Settings\Name\Desktop\example.txt") Then
WScript.Sleep 1500
x=MsgBox ("Warning! A infected file was found!",48,"Warning")
filesys.DeleteFile "C:\Documents and Settings\Name\Desktop\example.txt"
x=MsgBox ("File was deleted!",48,"File Deleted")
WScript.Sleep 1000
x=MsgBox ("This Computer is now clean!",64,"Hooray!")
Else
WScript.Sleep 500
x=MsgBox ("File not found! This Computer is clean!",64,"Hooray!")
End If
Is there also a way to make the username/file path work on any computer? I know it is
"C:\Documents and Settings\%username%\Desktop\example.txt"
in batch, but is there something like that in vbscript? Is there also a way to delete files with ANY extension that have 'example' in the name as well? For example:
filesys.DeleteFile "C:\Documents and Settings\Name\Desktop\example.anyextension"
Thanks so much! I hope you don't mind my huge amount of questions, I am just starting to code with VBS/VBScript and really appreciate your help! :)