Friday, March 22, 2019

Multiple commands in one line - Linux vs Windows

To separate multiple command in one line, Linux uses semicolon (;). e.g.

$ cd SubDir; ls

Windows CMD uses ampersand (&). e.g

$ cd SubDir & dir

And in Windows, if you want to stop when the first command fails, you can use double ampersands (&&). e.g.

$ cd SubDir && dir

In this case, if SubDir doesn't exists, "dir" will not run.

No comments:

Get This <