I've searched on here for a while but can't find a solution that works.
I'm attempting to run the following (test.bat):
SET CURRENT_DATE=%date:~6,4%_%date:~3,2%_%date:~0,2%
SET DOCSRC = "C:\scripts\e2Vault\docdata"
SET DOCSTAGING = "C:\Scripts\e2Vault\staging"
SET LOGFILE = "C:\Scripts\e2Vault\log files"
SET DOCPROCESS = "C:\scripts\e2Vault\process"
SET DOCREMOVED = "C:\scripts\e2Vault\removed"
forfiles /p "%DOCSRC%" /m *.drd /d -547 /c "cmd /c echo @path && Move @file "%DOCSTAGING%"" >> %LOGFILE%\e2Vault_archive_%CURRENT_DATE%.log
But it's giving me the following output without moving the files or logging:
C:\scripts\e2Vault>forfiles /p "" /m *.drd /d -547 /c "cmd /c echo @path && Move @file """ 1>>\e2Vault_archive_2012_06_19.log
ERROR: Value for '/p' option cannot be empty.
Type "FORFILES /?" for usage.
I have tried using """ and \" in various configurations but every one I try just displays the quotes where the variable should be.
As you can probably see I'm testing this but the live system paths for variables have spaces in them so I need to get it working.
If I do not use the SET variables and put in the absolute paths the script works.
Really hoping someone can point out what I'm doing wrong!