Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9194777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:29:34+00:00 2026-06-17T21:29:34+00:00

I have searched and searched to no avail so apologies if the answer does

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:29:36+00:00Added an answer on June 17, 2026 at 9:29 pm

    Dir

    Use the dir command. Type in dir /? for help and options.

    dir /a:d /b
    

    Redirect

    Then use a redirect to save the list to a file.

    > list.txt
    

    Together

    dir /a:d /b > list.txt
    

    This will output just the names of the directories. if you want the full path of the directories use this below.


    Full Path

    for /f "delims=" %%D in ('dir /a:d /b') do echo %%~fD
    

    Alternative

    other method just using the for command. See for /? for help and options. This can output just the name %%~nxD or the full path %%~fD

    for /d %%D in (*) do echo %%~fD
    

    Notes

    To use these commands directly on the command line, change the double percent signs to single percent signs. %% to %

    To redirect the for methods, 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.

    ... echo %%~fD>> list.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched and Googled for the answer to this question to no avail.
I have searched high and low to no avail, and this is last step
I have searched the web and to no avail have I found the answer
I have searched and not found a solution so sorry if this has been
I have searched around the web for an answer to this question to no
I've searched and racked to no avail.. so, does anyone have an algorithm to
This is quite frustrating and I searched a LOT to no avail. I have
I have searched endlessly to no avail on this, hopefully someone can help! I
I have searched for this, and i found that for api less than 12,
I have searched for a general solution to this but only find answers to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.