Solved

DOS Batch files :  looping

Posted on 2007-03-22
2
334 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
Comment Utility
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
Comment Utility
@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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

8 Experts available now in Live!

Get 1:1 Help Now