Create folders from txt file which need to be called

Viewed 23

I have problem with such task - Create folders from source.txt with names(could be with spaces) if folder haven't been creted write name in file Error.txt But it's not all :) file source.txt located in another folder. For example F:\Folder\source.txt and folders have to be created in F:\Folder\Fld1 I think the call command could be useful, but Idk how to use it. I tried call source.txt %~dp but it's useless when I'm moving to Fld1 to start for loop or just staying in Folder with source.txt

Here what I have so far(loop creating folders only in folder with source.txt but nowhere else)

for /F "delims== tokens=1,2" %G in (source.txt) do (
         md "%G" 
         if errorlevel 1 echo "%G" >> Error.txt

source.txt looks like:

Fold1
Fold2
Fold3
Fold4
Fold5
Fold6 
Fold Fold1
Fold Fold2
Fold Fold3
Fold Fold4
Fold Fold5
Fold Fold6

Thanks in advance!

0 Answers
Related