Hi, tried the suggestion and works exactly as hoped you guys are great, I'd be interested in a little explanation on what parts of the code do what as to hopefully get a better understanding so can try and work other coding out myself rather than have to ask for help.
@echo offTurn off automatic echoing of each command line to the console.
if exist list.txt del list.txtIf list.txt exists, delete it. By implication, if it does not exist, do nothing.
for /f "delims=" %%A in ('dir /b /ad') do dir /b /ad "%%A" >> list.txtThe
FOR /F command processes each line of e.g. a command output or text file, in this case the output of
dir /b /ad (executed in the same folder that the batch is in) and puts each line, one, by one, into the FOR "metavariable"
%%A. Each line is the name of a folder under the folder
a. So each time around the loop, the metavariable
%%A expands to the name of a folder. We do a
dir /b /ad on each of these folders, which gives the names of the sub folders contained within one level below. We echo that output to list.txt, using the
>> (append) operator.
You can find full explanations of batch commands on many websites, one of the best is SS64.com.
https://ss64.com/nt/for_f.html