Hi guys ive written a script for a school im working at to automatically mount a folder as drive X: and then to go into drive X and recursively scan all folders and sub folders for .bat .cmd .exe and .vbs. The script works almost perfectly my problem is that if there are any errors, eg; a drive path is too long it will not log it to a text file. Is there any way this can be done with a batch file?
@echo off net use X: \\NETWORK PATH HERE X: cls Echo Deleting bat files please wait... del /s *.bat > DeletedFiles.txt Echo Deleting CMD files please wait... del /s *.cmd >> DeletedFiles.txt Echo Deleting VBS files please wait... del /s *.vbs >> DeletedFiles.txt Echo Deleting Executable files please wait... del /s *.exe >> DeletedFiles.txt Echo Process Completed set /p=Press Any Key To Close
Currently any errors I have to read from the command line and sort out, it would be handy to have all errors and deleted files saved to a text file for record keeping purposes.
Also powershell is out of the question, despite being a system admin the education department will not give me rights to run powershell or vbs scripts.
Thanks Bryan, I cant believe a simple 4 characters could help me so immensely