I have searched and searched to no avail so apologies if the answer does exist.
I am not very good with batch files so please keep this in mind.
All I am after is a single batch file that will list/save to file a list of the folders within the current folder.
So basically if I run this batch file within a certain folder it will output all folders (not files or sub folders, just to one level) within the folder from which the batch file was run.
I assume this is probably an easy request however I have not had any luck on Google, etc.
Dir
Use the
dircommand. Type indir /?for help and options.Redirect
Then use a redirect to save the list to a file.
Together
This will output just the names of the directories. if you want the full path of the directories use this below.
Full Path
Alternative
other method just using the
forcommand. Seefor /?for help and options. This can output just the name%%~nxDor the full path%%~fDNotes
To use these commands directly on the command line, change the double percent signs to single percent signs.
%%to%To redirect the
formethods, just add the redirect after the echo statements. Use the double arrow>>redirect here to append to the file, else only the last statement will be written to the file due to overwriting all the others.