Discussion Locked

.bat to get user input & create subdirs?

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need a batch file to get user input, create a directory based on that user input, then create subdirectories for it.

Example:

When I run the batch, it asks me to input clients' last name.

I enter clients' last name and C:\Clients\ClientLastName\All Required Subdirectories is created.

Any suggestions?

4 replies

by toivo talikka

Here is an example:

Create the following script and call it clientdir.cmd:

C:
CD \Clients
SET /P cname=[Enter Last Name]
MKDIR %cname%
CD %cname%
MKDIR subdir1
MKDIR subdir2

You can set up a shortcut to clientdir.cmd. Enjoy!

by rebar doctor

I got this to work, not sure how, but it does. It will prompt for Folder name and will allow for long file names eg: Pictures taken at Beach
----------------------------------------------------------------------------------
::Batch file to create a folder from user input and then change to that folder.

@echo off
set /p variable=...Enter new folder Name\
md "%1 %2"
md "%variable%"
cd %variable%

This discussion is closed to new replies.