Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Windows command in chain

I found the bat file from here:

http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace

I want to run another command after this bat, but it doesn't work. I guess there must be something wrong the the code the site provides. Anyone can give me a clue?

like image 789
Frankel Avatar asked Oct 11 '10 08:10

Frankel


People also ask

How do you chain a command in Windows?

Try using the conditional execution & or the && between each command either with a copy and paste into the cmd.exe window or in a batch file. Additionally, you can use the double pipe || symbols instead to only run the next command if the previous command failed.

How do I Run a command sequentially in Windows?

Instead of scheduling multiple Windows Tasks that may overlap, use the "start /wait" command a batch file (. bat) to automatically run multiple commands in sequential order.

Can you Run multiple cmd?

Click Start, type cmd, and press Enter to open a command prompt window. In the Windows taskbar, right-click the command prompt window icon and select Command Prompt. A second command prompt window is opened.


1 Answers

As per Microsoft Support:

This behavior occurs because the && command separator performs error checking. If the command to the left of the && command does not return the expected results, the commands to the right of the && command do not run.

And

When you use a single & command, error checking is not performed and all commands run.

You can check here:

Using multiple commands and conditional processing symbols

Multiple Commands on a Single Line May Not Run When You Use the && Command Separator (archived page)

Original link - No longer exists

like image 164
Acapulco Avatar answered Oct 14 '22 08:10

Acapulco