Solved

Batch file asking for folder name?

Posted on 2010-11-25
3
280 Views
Last Modified: 2012-06-27
Hi,

I need to create a batch file that creates a new folder located on ex. \\192.168.1.X\Folder\Customer\"New folder here"

It should ask for name, and afterwards create the folder.
Itøs probably simple, but i'm not good with programming.

BR /Klaus
0
Comment
Question by:mpkontor
  • 2
3 Comments
 
LVL 95

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 50 total points
ID: 34211923
You prompt with
SET /P Variable=Prompt for input

You then reference the input with %Variable%.

For example:

Set /P Folder=Enter a Folder Name
MD \\192.168.1.x\share\folder\customer\%Folder%
0
 

Author Comment

by:mpkontor
ID: 34211973
I have one problem... One of the folders is called "D Customers" . So it just creates a folder called D and stops...???

Do I need to put it in qutaionmarks??
0
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 50 total points
ID: 34212030
You should always put paths in quotation marks - when it's not needed it won't matter and when it is needed, you won't have a problem.  Note - the ENTIRE path - not just a part:

GOOD:
MD "\\192.168.1.x\share\folder\customer\%Folder%"

BAD:
MD \\192.168.1.x\share\folder\customer\"%Folder%"
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

21 Experts available now in Live!

Get 1:1 Help Now