The answer to Question has already been answered, I'll just explain it a bit further. In Windows Command Line, We can execute multiple commands in just a single line
Using '&' (Ampersand) OR '&&' (Double Ampersand)
Using Single Ampersand & causes Sequential Execution ie. Commands run in the sequence they are entered. There is no condition checking in it. There may be a case when second command can execute successfully Only If the first command is executed successfully.
That introduces Double Ampersand && . This operator is kind of conditional operator and performs an Error Checking ie. Second command will execute only if the first command is executed successfully.
Example :
$ cd Docs & dir
First cd Docs will run & regardless of whether it was successful or not, second command dir will run.
If Docs folder exist then It will change the directory & then list contents of Docs using dir command.
- However
If Docs folder doesn't exist then It will give an error, but still dir will run to list the contents of current directory.
$ cd Docs && dir
Here, dir command will run only when current Directory is changed to Docs and that will happen only when Docs exist. So, you can interpret the command like - " If folder Docs exists, change the current directory and then list it's contents. "
This is very much useful in the Batch Programming and sometimes at Command-Line too.