title: ForFiles return code 1 within Windows Task Scheduler
body: <p>I am trying to delete files from a 2008 Windows Server that are older than 180 days based on the last modified date. I am using ForFiles in order to attempt to do this. When I run the command interactively as domain admin on the server, the command executes. When I setup a task within Windows task scheduler, the task fails to run with a return code of 1. </p>
  
  <p>The below command is the command I am running.</p>
  
  <pre><code>forfiles /p "E:" /s /m *.* /D -180 /c "cmd /c del @path &amp;&amp; echo"
  </code></pre>
  
  <p>I have also tried the below:</p>
  
  <p><img src="https://i.stack.imgur.com/n4yKv.png" alt="enter image description here"></p>