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.
精彩评论