Need to have an automatic way of creating new folders in Windows

Posted on 2006-04-19
Last Modified: 2010-04-13
I have a list of names in a text file that I need to create folders for. The list is over 1000 names long so that is over 1000 folders in Windows that needs to be created.  By hand that will take hours to do.  If I could create a batch file or a script that would read the list and create the folders based on the list.  The folders need to all be in the same root, so that makes it a bit easier.  The list is a plain text file with each name on a seperate line.  Here is an example...


Also, if someone knows of a program that does this automatically, that will be okay.
Question by:murryc
    LVL 95

    Expert Comment

    by:Lee W, MVP
    No script needed, just run this command:

    FOR /F "tokens=*" %a in (listofnames.txt) do MD %a
    LVL 11

    Accepted Solution

    Also VB script:

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("C:\temp\filename.txt", 1)
    Do Until objFile.AtEndOfStream
        strCharacters = objFile.ReadLine
        objFSO.createfolder strCharacters

    Author Comment

    leew...Should I not be able to run your command from a batch file?  I tried it and could not get it to work.

    star_trek...your VBS script worked like a champ.  I have a few changes I need to make to the script.  Do you want me to post a new question since this one was answered fully?
    LVL 11

    Expert Comment

    If the solution works for you, you need accept the answer. Then you can post a new question.
    LVL 95

    Assisted Solution

    by:Lee W, MVP
    No you can't run that command from a batch file.  I said no script needed - it's a simple command.

    If you want to run the command from a batch file, then you need to double the percent signs.

    FOR /F "tokens=*" %%a in (listofnames.txt) do MD %%a

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now