I have a script the generates a log file and appends to it every run. It also gets emailed to me every week. However with it running daily, it can get quite large. Is there a way to delete it at the start of the script on windows 7 if it's bigger than say, 1MB?
Presuming your script is not in powershell. Make sure your system is setup to allow powershell scripts. Do some test runs first, but you can write something similar to this in a file ending with the .ps1 extention and call it from your script as