batch file multiple actions under a if condition
Is there a way to put multiple actions under a if condition? Like this:
if not exist MyFolderName ( ECHO create a folder mkdir MyFolderName )
You can use & to join commands and execute them on the same line.
So your syntax should look like:
if not exist MyFolderName ECHO "Create a folder" & mkdir MyFolderName
Or you can use labels to jump to a section containing the commands you want to execute, for example:
if not exist MyFolderName GOTO DOFILESTUFF :AFTER ... EXIT :DOFILESTUFF ECHO "Create a folder" mkdir MyFolderName GOTO AFTER