batch file - Folder creation using bat command -
i have bat file create folder.
:x3main if exist "%1%\jboss" goto test if exist "%1%\db" goto db goto end :test mkdir "%destination%\ix3\cosmic\jboss" goto end :db mkdir "%destination%\ix3\cosmic\db" goto end
here first folder created successfully(if exist "%1%\jboss" goto test) second function not working. if remove first function second function working.
please can explain reason behind this?
some info: in nt line of windows reliable test folder need end foldername backslash
and may have meant %~1 instead of %1%
if exist "%~1\jboss\" task
and in case can use nothing if folder exists: 2>nul
eliminates harmless error message when folder exists.
mkdir "%destination%\ix3\cosmic\jboss" 2>nul mkdir "%destination%\ix3\cosmic\db" 2>nul
Comments
Post a Comment