批处理文件"为"命令 [英] Batch file "for" command
问题描述
需要使用Windows计划时间表的命令行操作,能够
Need to be able to "schedule" a command line action using windows scheduler.
这是我的命令:
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.
在为命令不起作用,作为调度,但工作在CMD.EXE
The "for" command does not work as in a scheduler but is working in cmd.exe
我需要一个批处理文件或其他code,这样我可以使用调度。
I need a batch file or other code so that I can use the scheduler.
我读到这些,但我只是不是很酷:
<一href=\"http://stackoverflow.com/questions/1502170/how-to-copy-files-from-folder-tree-dropping-all-the-folders-with-robocopy\">How复制从文件夹树中删除所有文件夹与文件的Robocopy?
I read these, but I'm just not that cool: How to copy files from folder tree dropping all the folders with Robocopy?
如何&QUOT;对于&QUOT;在cmd中批处理文件的工作?
推荐答案
把你上面code,并将其保存在的.bat
文件。你需要做的唯一的变化是一个批处理文件中运行时,百分比(%)需要加倍行动。
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\
)
这篇关于批处理文件&QUOT;为&QUOT;命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!