Solved

DOS Batch files :  looping

Posted on 2007-03-22
2
352 Views
Last Modified: 2010-08-05
@echo off
cls

set %File_Name%=%1

mkdir C:\Server\ticketing\%File_Name%      
mkdir C:\Server\ticketing\class\%File_Name%
mkdir C:\Server\ticketing\class\type\%File_Name%      


Here I am creating folder by entering argument from command line (C:\>createfolders.bat file1) ,  here I am able to create on folder at a time. But I want to create more then one folder at a time by entering more arguments like C:\>createfolders.bat file1 file2 file3.  Is this possible, if it can how?
0
Comment
Question by:MADHU_N
2 Comments
 
LVL 30

Accepted Solution

by:
SteveGTR earned 500 total points
ID: 18776568
Try this:

@echo off

:START

if "%~1"=="" goto :EOF

mkdir "C:\Server\ticketing\%~1"
mkdir "C:\Server\ticketing\class\%~1"
mkdir "C:\Server\ticketing\class\type\%~1"

shift
goto START

Good Luck,
Steve
0
 
LVL 5

Expert Comment

by:GirardAndrew
ID: 18783752
@echo off
cls

:1st
set %File_Name%=%1
mkdir C:\Server\ticketing\%File_Name%
mkdir C:\Server\ticketing\class\%File_Name%
mkdir C:\Server\ticketing\class\type\%File_Name%

:2nd
set %File_Name%=%2
mkdir C:\Server\ticketing\%File_Name%
mkdir C:\Server\ticketing\class\%File_Name%
mkdir C:\Server\ticketing\class\type\%File_Name%

:3rd
set %File_Name%=%3
mkdir C:\Server\ticketing\%File_Name%
mkdir C:\Server\ticketing\class\%File_Name%
mkdir C:\Server\ticketing\class\type\%File_Name%
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

773 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