Im new to VBS and need help creating a fewscripts to find and delet efiles and or folders.
Script #1 Search every folder/sub folder on C drive for a specific file, lets say "badfile.exe" and then delete it, pop up a message saying "badfile.exe deleted successfully" or "file not found".
Script #2 Search C drive for a folder, lets say "badfolder" then delete it and its content, pop up a message saying "badfolder deleted successfully" or "folder not found".
Script #3 Search C drive for a folder lets say "badprogram" then look for a file in that folder lets say "uninstall.exe" and run the file to uninstall the badprogram or pop up a message saying "file not found"
Thanks
Answers (3)
Comments:
-
I assume there is suppose to be a box that pops up where I enter the file name to search for and another to enter where I want it to start searching but they never pop up as I get the following error on line
53 MsgBox "Found it in: " & folder", 48, "File Found"
VB Sripts\ninja.vbs(53, 32) Microsoft VBScript compilation error: Expected end of statement - sorensenbrad 9 years ago-
Change:
MsgBox "Found it in: " & folder", 48, "File Found"
to:
MsgBox "Found it in: " & folder, 48, "File Found" - anonymous_9363 9 years ago
Just go to computerperformance.com. There are scripts of every kind imaginable there. You probably won't ever find a single script that does everything you want but you can mix and match.
If I can offer some advice, though...
- Always assume the worst, i.e. that *nothing* will work and error-trap everything, even creating well-known objects.
- Find and use a logging class (don't be put off by that word - it's just a collection of functions and property gets/sets) so that logging your script's activity becomes second nature and not something you tack on to the end as an after-thought.
- Test *every* scenario, even those that "won't ever happen" because you can bet that one day, "never" comes around!
53 MsgBox "Found it in: " & folder", 48, "File Found"
VB Sripts\ninja.vbs(53, 32) Microsoft VBScript compilation error: Expected end of statement - sorensenbrad 9 years ago