title: Windows shell script to delete temp files and folders in windows 2003 server older than 24 hours/1 days
body: <p>There has been lot of confusion to come up with exact script, which would run on my windows 2003 server.</p>
  
  <p>The scripts which I have tried are below:</p>
  
  <pre><code>forfiles.exe /p C:\Windows\Temp /s /m *.* /d - /c "cmd /c del @file
  
  forfiles -p "C:\Windows\Temp" -s -m *.* -d -1 -c "cmd /c del /Q @path
  </code></pre>
  
  <p><strong>Deletes everything rather deleting files older than 24 hourr or 1 day old</strong></p>
  
  <pre><code>@echo off
  cd /d "C:\Windows\Temp"
  rd /s /q "C:\Windows\Temp"
  </code></pre>
  
  <p><strong>No option in the task scheduler to delete the files and folders older than X hours</strong></p>
  
  <p>Note: I am not looking for Powershell, VB or Python</p>
  
  <p>Please help.</p>