cmd batch create files and folders

Generate folder or file

for /l %i in (2,1,10) do md D:\test\新建文件夹%i

Copy the above statement to cmd for execution. If it is a batch process, change %i to %%i. If it is a file, it is

for /l %i in (2,1,10) do cd.> D:\test\新建文件%i.txt
学过一点python的应该知道,前面是一个循环语句2,1,10:编号为2~10,步长为1
md:即makedir创建文件夹
后面即是要创建文件夹的路径
Generate a folder (file) with the specified name
for /f %i in (D:\test\name.txt) do md D:\test\%i

Copy the above statement to cmd for execution. If it is a batch process, change %i to %%i. If it is a file, it is

for /f %i in (D:\test\name.txt) do cd.> D:\test\%i
/f:f即file,读取对象是文件
(D:\test\name.txt):从该name.txt文档中读取名称 
md D:\test\%i:在指定路径下生成文件夹

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43311695/article/details/107991989