[bat] Batch File Help

Newbie Spellweaver
Joined
Dec 11, 2007
Messages
85
Reaction score
1
Eh it may be a stupid question but I was wondering how I could make sub folders inside a folder I made with a .bat file.

My .bat file code is this:

PHP:
@echo off
md Folder 1
md Folder 2
md Folder 3

Like that it makes 3 folders one called Folder 1,Folder 2 and Folder 3. What I need it to do is make a folder inside a folder or make a program inside a program.


Btw for those who dont know what a batch file is:

1)Open up Notepad.exe.
2)Type in '@ echo off' with out the ''.
3)On the next line either type in:
md (Insert folder name here)
start (Insert program name inside qoutes here)
4)Click File->Save As-> (Anyname).bat
5)Exit Notepad.exe.
6)Run (Anyname).bat.
7)It should do the command that you told it to do.
8)Your done!

There are far more commands other than 'md' and 'start'. You can find more on google :D~

Commands:
-----------
start: Runs the program which you speicfied.
md: Creates a folder with the name you specified after md.
 
I think you have to do a cd command on the folder you wish to create the subfolder in. Then you create the directory you wish for with the md command.

Example:
Code:
@echo off
md the_folder_that_contains_a_subfolder
cd the_folder_that_contains_a_subfolder # open the folder above
md make_the_directory_you_wish_for

Haven't tested, but I think it would work.
 
Uhh XD It didnt work....

What about something liek this?

@echo off
md Folder 1
start Folder 1
(Insert command that makes a folder in the opened folder?)
 
In what way didn't it work?

The cd and the start command is different.
Just look up on an Batch reference, it will have all the info you will need.
 
Back