Help with mkdir

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rileyh
Posts: 147
Joined: 01 Sep 2011 03:54
Location: Perth, Western Australia

Help with mkdir

#1 Post by Rileyh » 11 Oct 2011 03:59

Hi,
I am having trouble with the command "mkdir"/md. I have checked the cmd help (md /?) and it doesn't give me any syntax examples.
I want to make my batch file ask in which directory to make a folder, and my code is:

Code: Select all

set /p config=Confirming that you have specified drive %var%? (type Y/N):
if /i _"%config% == _"Y" (md %var%:\%var2%) else goto :dir
if /i _"%config% == _"Y" (md %var%:\%var2%\%user%) else goto :dir



Any help would be appreciated,
Rileyh

OJBakker
Expert
Posts: 31
Joined: 12 Aug 2011 13:57

Re: Help with mkdir

#2 Post by OJBakker » 11 Oct 2011 08:17

I see 2 problems with the if/i command
1. You are missing a double-quote in the left part of the condition
2. Get rid of the spaces surrounding the ==

Code: Select all

if /i _"%config%"==_"Y" 

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Help with mkdir

#3 Post by !k » 11 Oct 2011 08:36

Code: Select all

if /i "%config%" == "Y" (md %var%:\%var2%\%user%) else goto :dir

works fine and makes both dirs

Rileyh
Posts: 147
Joined: 01 Sep 2011 03:54
Location: Perth, Western Australia

Re: Help with mkdir

#4 Post by Rileyh » 12 Oct 2011 00:08

!k,
Thanks for the post- it works great.

Post Reply