Bat files:
You can use the below command to delete temp files using below command:
cd C:\Users\mn\AppData\Local\Temp echo y | del * cd C:\Windows\Temp echo y | del * exit
Change the user name to yours and save as bat file.
Procedure:
You can create a local computer policy on Windows. See the TechNet at Click
1) Run gpedit.msc to open the Group Policy Editor,
2) Navigate to Computer Configuration | Windows Settings | Scripts (Startup/Shutdown).