Solved

How to make prompted directory

Posted on 2007-03-24
2
167 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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now