0

I would like to be able to get path from user like (C:\Users\mehak\Downloads\folderA\folderB)

SET /P USER_INSTALL= Installation Path : 

Now i want to check if (FolderA) exists then create a subfolder (folderB).

Does anybody have any idea how can i create a batch file to allow me to do this?

mehak
  • 11
  • 4
  • 4
    Possible duplicate of [Checking if a folder exists using a .bat file](https://stackoverflow.com/questions/21033801/checking-if-a-folder-exists-using-a-bat-file) – Cristian Ramon-Cortes Sep 18 '17 at 06:18

1 Answers1

0
MD "%user_install%\folderb"  >nul 2>nul
if exist "%user_install%\folderb\." (
 echo Folderb created
) else (
 echo Folderb not created
)

Will create folderb under %user_install% whether or not either already exists.

Don't move the parentheses in the if statement - they are quite critical.

Magoo
  • 77,302
  • 8
  • 62
  • 84