Page 1 of 1

Help with mkdir

Posted: 11 Oct 2011 03:59
by Rileyh
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

Re: Help with mkdir

Posted: 11 Oct 2011 08:17
by OJBakker
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" 

Re: Help with mkdir

Posted: 11 Oct 2011 08:36
by !k

Code: Select all

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

works fine and makes both dirs

Re: Help with mkdir

Posted: 12 Oct 2011 00:08
by Rileyh
!k,
Thanks for the post- it works great.