开发者

DOS Batch file - Need help to reading a text file to create a folder then two sub folders in the that folder

for /F "tokens=*" %* in (C:\Test.txt) do (md "C:\TEMP\%*" || cd "C:\TEMP\%*" || md "Computer" || md "Email")

With this command I can create the one folder per name in test.txt开发者_StackOverflow but it won't let me create the subfolders.

Ideally it would create folder Smith then every folder would get two identical subfolders Car and House.

Thanks for any help.


Very impressive usage of batch script. :-) It has been long since I last saw someone writing .bat script. Would you try:

for /F "tokens=*" %x in (C:\Test.txt) do mkdir c:\temp\%x\Computer c:\temp\%x\Email
  • mkdir accepts multiple directory names.
  • you must do "cd .." if you do "cd C:\temp" at first. but cd is not necessary at all.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜