Web Development

General discussion


.bat to get user input & create subdirs?

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


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?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Toivo Talikka In reply to .bat to get user input & ...

Here is an example:

Create the following script and call it clientdir.cmd:

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!

Collapse -

by Charger Media In reply to

That worked!! Thank you kindly

Collapse -

Folder name greater than 8 characters

by Rebar Doctor In reply to

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%

Collapse -

by Charger Media In reply to .bat to get user input & ...

This question was closed by the author

Related Discussions

Related Forums