Uncategorized

Cleaning up files with powershell GUI confirmation

After automating my report last week, I decided I did not need a copy left lying around, so I decided to write a cleanup script.

My first version was very simple, and consisted of just the required code to recurse the directory and delete the files.

It occurred to me that a Yes/No MsgBox to confirm the deletion would be a nice addition. So without further adieu, here is the code.

And here is the output

MsgBox output from script

See how nice that looks? You can use all the Windows GUI Framework in your scripts. I will be designing a script next week that uses several parts of the windows framework to make the script more end user friendly. Keep reading to see my progress and learn how to apply these techniques to your script!