batch mkdir return codes -


my batch script checks see if folder exists , if doesn't make directory. running other problems besides if folder there, cannot place finger on is. there way return error code determine problem?

code:

if not exist "%arcval_folder%" (     mkdir "%arcval_folder%"     echo directory: "%arcval_folder%" created. 1>>"%logfile%" 2>&1     echo. 1>>"%logfile%" 2>&1 ) 

i keep getting folder created, when had not on inspection of target location.

you can try checking return of mkdir command using %errorlevel% pseudo-variable:

c:\users\dwilches>

c:\users\dwilches>mkdir test  c:\users\dwilches>echo %errorlevel% 0  c:\users\dwilches>mkdir test subdirectory or file test exists.  c:\users\dwilches>echo %errorlevel% 1 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -