title: Using FOR loop in Psexec
body: <p>I'm trying to use remotely a for loop with a psexec but I can't do it. Also I neet to use it with a variable (date)</p>
  
  <p>I'm trying something like that</p>
  
  <pre><code>psexec -u user -p password \\computer cmd /c FOR /R C:\FOLDER1\%date%\ %i in (*.txt) do C:\FOLDER2\MyTool.exe %i
  </code></pre>
  
  <p>I'm tried to put it in many ways but it didn't work. Sometimes it return unexpected error or something like \FOLDER1\%date%\ was not expected in this moment.</p>
  
  <p>If I connect to the remote computer with psexec and after that I write the next sentence it works.</p>
  
  <pre><code>FOR /R C:\FOLDER1\%date%\ %i in (*.txt) do C:\FOLDER2\MyTool.exe %i
  </code></pre>
  
  <p>But I need to use inside my batch, not outside.</p>
  
  <p>What is wrong? What can I do?</p>