views:

935

answers:

2

hi all,

thanks to all for ur valuable replies..

Also, in linux mkdir -p creates a folder tree..

What is the equivalent option in Windows( to create a folder tree) ? Is there any?

Renjith G

+1  A: 

In Windows, mkdir creates directory trees by default.

mkdir a\b\c

Alan Haggai Alavi
I think you wanted to put `md` and not `mkdir`.
Shyam
Both `mkdir` and `md` are the same in Windows.
Alan Haggai Alavi
Except you happen to have some GNUWin32 stuff lying around in your path. Then, weirdly, the GNU mkdir is called upon using mkdir (and it took me a while to find out why I couldn't create folder trees anymore ...) :-)
Joey
That is new information for me. Thank you Johannes. :-)
Alan Haggai Alavi
great observation
Renjith G
+4  A: 

The Windows mkdir does it automatically if command extensions are enabled. They are on just about every box I've ever used but, if they're not, you can create your own script to do it:

@echo off
setlocal enableextensions
md %1
endlocal

Expanding:

Command extensions are an added feature of cmd.exe which allows you to do so much more (at the cost of a little compatibility with earlier incarnations of the batch language).

Windows XP cmd.exe should have these extensions enabled by default but you can configure your box so that they're disabled by default (using "cmd /e:off" as the default processor). If you do that and want to use the extensions, your cmd files must have a setlocal to turn them back on.

The script above could be called md2.cmd and then you would be guaranteed to be able to create multiple directory levels with "md2 a\b\c" without having to worry whether the extensions were enabled.

Almost every one of the cmd scripts I write begins with:

setlocal enableextensions enabledelayedexpansion

to ensure I get as close as possible to the behavior of my beloved bash :-)

paxdiablo
i didn't understand..can u pls explain again?
Renjith G
@Renjith, see the expansion I added, it may explain better.
paxdiablo
thanks alot Mr.Pax
Renjith G
Can u give some links regarding the tuitorials of makefiles..i donno more abt them..i want to study the makefiles from the beginning...
Renjith G
Wrong question, @Renjith, I think you meant to add that comment to this question here: http://stackoverflow.com/questions/892585/make-linux-and-windows-formats
paxdiablo