title: Windows cmd FORFILES not working in batch file,but works in command prompt
body: <p>In the below batch script the line with command FORFILES is not working.
  The same statement works fine when it is run separately from a different batch file or from command prompt.
  All other statements in the script works fine. 
  I have gone through all solutions for similar problems.</p>
  
  <pre><code>@echo off
  setlocal
  
  SET vFileShare=C:\Users\asande\task\
  SET archiveFileList=ArchiveFilesList.txt
  SET archFileTimestamp=%date:~10,4%%date:~7,2%%date:~4,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
  rem SET archFileName=%fSignature%%archFileTimestamp%
  SET archiveFolder=C:\Users\asande\task\archives\
  SET PATH=C:\Program Files\7-Zip
  
  FORFILES /P %archiveFolder% /M *.zip /C "cmd /c del @file" /d -1
  
  IF EXIST %vFileShare%%archiveFileList%. (
              cd %vFileShare%
              7z a -tzip %archiveFolder%%archFileTimestamp%.zip @ArchiveFilesList.txt
  ) ELSE (
       ECHO %archiveFileList% missing.&gt;&gt;%vFileShare%\Polaris_DatedConversionRate.log.
   )
  
  
  endlocal
  
  GOTO: EOF
  </code></pre>