1

Need to be able to "schedule" a command line action using windows scheduler.

This is my command:

for /r C:\Users\bob\Downloads\Done\ %f in (*) do @move "%f" C:\Users\bob\Downloads\Done\

It flattens all files into the main folder.

The "for" command does not work as in a scheduler but is working in cmd.exe

I need a batch file or other code so that I can use the scheduler.

I read these, but I'm just not that cool: How to copy files from folder tree dropping all the folders with Robocopy?

How does "FOR" work in cmd batch file?

Community
  • 1
  • 1
Tad
  • 13
  • 2
  • 1
    **for** is built into cmd.exe, so you can just use `cmd` as the command and `/c for /r ...` as the parameters. Alternatively put the line into a .cmd (or .bat) file (i.e., create a script) and schedule the script. – Bill_Stewart Jun 19 '14 at 21:11

1 Answers1

0

Take your above code and save it in a .bat file. The only change you need to make, is that percents (%) need to be doubled-up when run inside a batch file.

for /r C:\Users\bob\Downloads\Done\ %%f in (*) do (
    @move "%%f" C:\Users\bob\Downloads\Done\
)
Aaron
  • 55,518
  • 11
  • 116
  • 132