To create multiple folders from a list in a .txt
file using Command Prompt, you can follow these steps:
-
Prepare your
.txt
file: Ensure your.txt
file contains the names of the folders you want to create, with each folder name on a new line. For example:Folder1 Folder2 Folder3
-
Open Command Prompt:
- Press
Win + R
, typecmd
, and hitEnter
.
- Press
-
Navigate to the directory where you want to create the folders: For example, if you want to create the folders in
C:\Users\YourName\Documents
, type:cd C:\Users\YourName\Documents
-
Use the
for /f
command to create folders:- If your
.txt
file is calledfolders.txt
and it's located inC:\path\to\your\file
, you can use the following command:
for /f "delims=" %i in (C:\path\to\your\file\folders.txt) do mkdir "%i"
This command reads each line from the
.txt
file (folders.txt
) and creates a folder with that name. - If your
Explanation:
for /f "delims=" %i in (path)
loops through each line in the file.mkdir "%i"
creates a folder using the value (%i
) from the current line of the.txt
file.
Note:
- If you want to run this in a batch file, replace
%i
with%%i
.
For example, in a .bat
file:
for /f "delims=" %%i in (C:\path\to\your\file\folders.txt) do mkdir "%%i"
No comments:
Post a Comment