Solved

How to make prompted directory

Posted on 2007-03-24
2
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

737 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