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
)

Answers


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

UPDATE

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

Need Your Help

String resource with font tag not working

android html string

I need help displaying color from the next string resource to the textview

How to print file contents with filename before each line?

python perl bash scripting sed

I have several files, say, a,b,c, I would like to something like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.