简体   繁体   English

Windows 7 bat文件遗漏了部分命令

[英]windows 7 bat file leaves out parts of the command

I made a batch file with one command in it so that i dont have to remember the code. 我用一个命令制作了一个批处理文件,这样我就不必记住代码了。 thought it would be simple however the code that it prints out when running it is not the code that is in the file. 认为这很简单,但是运行时打印出的代码不是文件中的代码。 heres the only line in the file 这是文件中的唯一一行

 for /f "tokens=*" %f in ('dir /a:-D /s /b') do move "%f" .

I have run this code in the command prompt and it does what i want it to however when i put it in a batch file and run it this the code that is read by the cmd 我已经在命令提示符下运行了此代码,但它确实实现了我想要的功能,但是当我将其放入批处理文件中并运行此命令时,该命令将由cmd读取

C:\Users\Erik\Desktop\google music backup>movefromsubfolders
-D was unexpected at this time.

C:\Users\Erik\Desktop\google music backup>for /f "tokens=*" -D /s /b') do move "f" .

why is it screwing everything up? 为什么要搞砸一切? This is the first bat file i have ever attempted to write so i could possibly be doing something stupid 这是我尝试写入的第一个蝙蝠文件,因此我可能会做一些愚蠢的事情

批量使用时,您需要加倍%

for /f "tokens=*" %%f in ('dir /a:-D /s /b') do move "%%f"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM