Command line: Create folders in subfolders with sp

2019-04-17 06:49发布

For a project I received 700 folders with names of institutions (containing spaces). The purpose is now to create subfolders in each of these folders.

[institution folder]\Documents\ [institution folder]\Images\ [institution folder]\Videos\

According some posts here the below script should work to create the Documents folder

FOR /d %A IN (C:\Users\myname\project\institutions\*) DO mkdir %A\Documents

However, I notice in the feedback that I get from the command line that this instruction fails at the spaces in the foldername. How can I get this to work?

2条回答
等我变得足够好
2楼-- · 2019-04-17 07:23
FOR /d %A IN (C:\Users\myname\project\institutions\*) DO mkdir "%A"\Documents

should do the trick.

查看更多
何必那么认真
3楼-- · 2019-04-17 07:23

make sure you wrap expressions containing spaces with " to make sure the shell sees them as a single entity.

查看更多
登录 后发表回答