Solved

How to make prompted directory

Posted on 2007-03-24
2
169 Views
Last Modified: 2010-04-16
Hi, I am prompting user for a directory to be created in my batch file using
set /p dir=Enter the folder to create:
but when I go to mkdir, it is not makeing the right directory.
Sometimes it makes 2 or more directorys from the command.
How can I fix this?

0
Comment
Question by:sher19
  • 2
2 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18786972
Hello sher19,

Use the quotes around your directory...odds are the user is entering a directory with spaces in the name...
So, in your code, isntead of

mkdir %dir%

use

mkdir "%dir%"

Regards,

sirbounty
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18786973
I would probably advise against using dir as a variable as well...since it's an internal command.
I usually use something like

set strDir /p = Enter the folder to create
md "%strDir%
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

777 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