|
Answer» Hey guys, im trying to create a batch file that will create 5 different folders. I also need to use an increment at the end of each folder so there will be folder1, folder2 ETC...
so in pseudocode it would be something like
a=1 initialize loop for 5 times create folder (using md folder(place variable here)) increment variable a loop confirmation/error message pause exit
i can do this in C but making a batch file using Machine language is MUCH easier, if i knew how to do it... any help would be great.. THANK you
Khasiar. @echo off set num=1 :loop md folder%num% if %errorlevel%==0 (Echo Created Folder%num%!) else (echo ERROR FOLDER%num%) set /a num+=1 if %num%==6 goto eof goto loop :eof pause >nulCode: [Select]@echo off FOR /L %%i IN (1,1,5) DO ( md folder%%i echo folder%%i )
OUTPUT:
C:\batextra>kaus.bat folder1 folder2 folder3 folder4 folder5 ___________________________
C:\batextra>cd folder1
C:\batextra\folder1>Thanks guyz, both ways worked equally fine. this will SAVE me heaps of tmie Quote heaps of tmie To make five folders? I just made five e folders in 13 seconds. By hand. And I am slow How much time did you save? From the time you did the post until you got five folders.Quote from: Geek-9pm on October 25, 2009, 09:01:51 PM To make five folders? I just made five e folders in 13 seconds. By hand. And I am slow How much time did you save? From the time you did the post until you got five folders.
the only difference is, you don't want to do that , say OP's requirement is to make 5 everyday. you are definitely not going to do that by hand every day.or maybe to make 5 every 20 minutes?... that's definitely a candidate for automation.Excatly right, and SOMEDAYS the number can increase, its just sooooo much easier, thanks again guyz, you have definetly made my work days 10X easier xD
|