- 1 year ago
Passing multiple commands to START command in batch file
Comment
1 / 1
In a Windows batch file, you can pass multiple commands to the START
command by using the /D
option followed by the commands enclosed in double quotes. Here's the syntax:
batchSTART "WindowTitle" /D "WorkingDirectory" command1 & command2 & ...
"WindowTitle"
: This is the title you want to give to the new command prompt window."WorkingDirectory"
: This is the directory in which you want to execute the commands.command1
,command2
, ...: These are the commands you want to run sequentially.
Here's an example of how to use the START
command to run multiple commands:
batch@echo off
START "My Commands" /D "C:\Path\To\Working\Directory" echo Command 1 & echo Command 2 & pause
In this example:
- The title of the new command prompt window is set to "My Commands".
- The working directory is set to "C:\Path\To\Working\Directory".
echo Command 1
,echo Command 2
, andpause
are executed sequentially.
Each command is separated by the &
symbol, which indicates that the next command should be executed after the previous one finishes.
Remember to adjust the paths, commands, and working directory as needed for your use case.