Start a program, command or batch script (opens in a new window.)
Syntax START "title" [/D path] [options] "command" [parameters] Key: title Text for the CMD window title bar (required.) path Starting directory. command The command, batch file or executable program to run. parameters The parameters passed to the command. Options: /MIN Start window Minimized. /MAX Start window Maximized. /W or /WAIT Start application and wait for it to terminate. (see below) /LOW Use IDLE priority class. /NORMAL Use NORMAL priority class. /ABOVENORMAL Use ABOVENORMAL priority class. /BELOWNORMAL Use BELOWNORMAL priority class. /HIGH Use HIGH priority class. /REALTIME Use REALTIME priority class. /B Start application without creating a new window. In this case Ctrl-C will be ignored - leaving Ctrl-Break as the only way to interrupt the application. /I Ignore any changes to the current environment. Use the original environment passed to cmd.exe /NODE The preferred Non-Uniform Memory Architecture (NUMA) node as a decimal integer. /AFFINITY The processor affinity mask as a hexadecimal number. The process will be restricted to running on these processors. Options for 16-bit WINDOWS programs only /SEPARATE Start in separate memory space. (more robust) 32 bit only. /SHARED Start in shared memory space. (default) 32 bit only.
Always include a TITLE this can be a simple string like “My Script” or just a pair of empty quotes “”
According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.
If command is an internal cmd command or a batch file then the command processor is run with the /K switch to cmd.exe. This means that the window will remain after the command has been run.
In a batch script, a START command without /wait will run the program and just continue, so a script containing nothing but a START command will close the CMD console and leave the new program running.
Document files can be invoked through their file association just by typing the name of the file as a command.
e.g. START “” MarchReport.DOC will launch the application associated with the .DOC file extension and load the document.
To minimise any chance of the wrong exectuable being run, specify the full path to command or at a minimum include the file extension: START “” notepad.exe
If you START an application without a file extension (for example WinWord instead of WinWord.exe)then the PATHEXT environment variable will be read to determine which file extensions to search for and in what order.
The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD
Start /Wait
The behaviour of START /Wait will vary depending on the item being started, for example
Echo Starting START /wait "demo" calc.exe Echo Done
The above will start the calculator and wait before continuing. However if you replace calc.exe with Winword.exe, to run Word instead, then the /wait will stop working, this is because Winword.exe is a stub which launches the main Word application and then exits.
A similar problem will occur when starting a batch file, by default START will run the equivalent of CMD /K which opens a second command window and leaves it open. In most cases you will want the batch script to complete, then just close it’s CMD console and resume the initial batch script. This can be done by explicitly running CMD /C …
Echo Starting START /wait "demo" CMD /c demoscript.cmd Echo Done
Add /B to have everything run in a single window.
In a batch file, an alternative is to use TIMEOUT to delay processing of individual commands.
START vs CALL
Starting a new process with CALL, is very similar to running START /wait, in both cases the calling script will (usually) pause until the second script has completed.
Starting a new process with CALL, will run in the same shell environment as the calling script. For a GUI application this makes no difference, but a second ‘called’ batch file will be able to change variables and pass those changes back to the caller.
In comparison START will instantiate a new CMD.exe shell for the called batch. This will inherit variables from the calling shell, but any variable changes will be discarded when the second script ends.
Run a program
To start a new program (not a batch script), you don’t have to use CALL or START, simply enter the path/file to be executed, either on the command line or within a batch script.
On the command line, CMD.EXE does not wait for the application to terminate and control immediately returns to the command prompt.
Within a command script CMD.EXE will pause the initial script and wait for the application to terminate before continuing.
If you run one batch script from another without using either CALL or START, then the first script is terminated and the second one takes over.
Multiprocessor systems
Processor affinity is assigned as a hex number but calculated from the binary positions (similar to NODRIVES)
Hex Binary Processors 1 00000001 Proc 1 3 00000011 Proc 1+2 7 00000111 Proc 1+2+3 C 00001100 Proc 3+4 etc
Specifying /NODE allows processes to be created in a way that leverages memory locality on NUMA systems. For example, two processes that communicate with each other heavily through shared memory can be created to share the same preferred NUMA node in order to minimize memory latencies. They allocate memory from the same NUMA node when possible, and they are free to run on processors outside the specified node.
start /NODE 1 app1.exe start /NODE 1 app2.exe
These two processes can be further constrained to run on specific processors within the same NUMA node.
In the following example, app1 runs on the low-order two processors of the node, while app2 runs on the next two processors of the node. This example assumes the specified node has at least four logical processors. Note that the node number can be changed to any valid node number for that computer without having to change the affinity mask.
start /NODE 1 /AFFINITY 0x3 app1.exe start /NODE 1 /AFFINITY 0xc app2.exe
Running executable (.EXE) files
When a file that contains a .exe header, is invoked from a CMD prompt or batch file (with or without START), it will be opened as an executable file. The filename extension does not have to be .EXE. The file header of executable files start with the ‘magic sequence’ of ASCII characters ‘MZ’ (0x4D, 0x5A) The ‘MZ’ being the initials of Mark Zibowski, a Microsoft employee at the time the file format was designed.
Command Extensions
If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:
Non-executable files can be invoked through their file association just by typing the name of the file as a command. (e.g. WORD.DOC would launch the application associated with the .DOC file extension). This is based on the setting in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ext\OpenWithList, or if that is not specified, then the file associations – see ASSOC and FTYPE.
When executing a command line whose first token is the string CMD without an extension or path qualifier, then CMD is replaced with the value of the COMSPEC variable. This prevents picking up CMD.EXE from the current directory.
When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the COMSPEC environment variable. This prevents picking up CMD.EXE from the current directory.
When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD Notice the syntax is the same as the PATH variable, with semicolons separating the different elements.
When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name. If it does, the START command launches the Explorer on that path. If done from the command line, it is the equivalent to doing a CD /D to that path.
Errorlevels
If the command is successfully started ERRORLEVEL =unchanged, typically this will be 0 but if a previous command set an errorlevel, that will be preserved (this is a bug).
If the command fails to start then ERRORLEVEL = 9059
START /WAIT batch_file – will return the ERRORLEVEL specified by EXIT
Examples
Run a minimised Login script:START "My Login Script" /Min Login.cmd
Start a program and wait for it to complete before continuing:START "" /wait autocad.exe
Open a file with a particular program:START "" "C:\Program Files\Microsoft Office\Winword.exe" "D:\Docs\demo.txt"
Open Windows Explorer and list the files in the current folder (.) :C:\any\old\directory> START .
Connect to a new printer: (this will setup the print connection/driver )START \\print_server\printer_name
Start an application and specify where files will be saved (Working Directory):
START /D C:\Documents\ /MAX "Maximised Notes" notepad.exe
START is an internal command.
From Wikipedia, the free encyclopedia
The ReactOS |
|
Developer(s) | IBM, Microsoft, ReactOS Contributors |
---|---|
Operating system | OS/2, Microsoft Windows, ReactOS |
Type | Command |
In computing, start
is a command of the IBM OS/2,[1] Microsoft Windows[2] and ReactOS[3] command-line interpreter cmd.exe[4] (and some versions of COMMAND.COM) to start programs or batch files or to open files or directories using the default program. start
is not available as a standalone program. The underlying Win32 API is ShellExecute
.
The command is also one of the basic commands implemented in the Keyboard Monitor (KMON) of the DEC RT-11 operating system.[5]
The TOPS-10[6] and TOPS-20[7] operating systems also provide a start
command. It is used to start a program in memory at a specified address.
START
command of RT-11SJ displayed on a VT100.- Typical Unix shells (bash, etc.) have no built-in registry of file types and associated default applications. Linux command-line tools with similar functions include
xdg-open
[8] andrun-mailcap
. - On Cygwin, the command is implemented as the
cygstart
executable.[9] - In PowerShell, the
Invoke-Item
cmdlet is used to invoke an executable or open a file.[10] - On Apple macOS and MorphOS, the corresponding command is
open
.[11] - On Stratus OpenVOS it is
start_process
.[12]
start ["title"] [/D path] [/I][/B][/MIN][/MAX][/WAIT] [command/program] [parameters]
«title» Title of the window.
Path Specifies the startup directory.
I Use the original environment given to cmd.exe, instead of the current environment.
B Starts the command or program without creating any window.
MIN Starts with a minimized window.
MAX Starts with a maximized window.
WAIT Starts the command or program and waits for its termination.
command Specifies the parameters to be given to the command or program.
C:\>start notepad file.txt
C:\>start "C:\My Music\My Song.mp3"
C:\>start www.wikipedia.org
- Run command
- File association § Microsoft Windows
- ^ «JaTomes Help — OS/2 Commands». Archived from the original on 2019-04-14. Retrieved 2019-07-06.
- ^ «MS-DOS and Windows command line start command».
- ^ «Reactos/Reactos». GitHub. 3 January 2022.
- ^ «Start». Microsoft Learn. 2021-11-12. Retrieved 2023-11-22.
- ^ «Rt-11 Help File». Archived from the original on 2018-07-17. Retrieved 2018-07-16.
- ^ TOPS-10 Operating System Commands Manual (PDF). Digital Equipment Corporation. August 1980. Archived from the original (PDF) on 2020-08-09. Retrieved 2019-02-17.
- ^ «TOPS-20 Command manual» (PDF). Archived from the original (PDF) on 2020-08-09. Retrieved 2018-07-18.
- ^ «XDG-utils».
- ^ «cygstart man page on Cygwin». www.polarhome.com.
- ^ «Start — Start a program — Windows CMD — SS64.com». ss64.com.
- ^ «Shell Commands/Open — MorphOS Library». library.morph.zone. Retrieved 2024-07-11.
- ^ Stratus Technologies Bermuda, Ltd (2017). «OpenVOS Commands Reference Manual» (PDF).
- Kathy Ivens; Brian Proffit (1993). OS/2 Inside & Out. Osborne McGraw-Hill. ISBN 978-0078818714.
- Frisch, Æleen (2001). Windows 2000 Commands Pocket Reference. O’Reilly. ISBN 978-0-596-00148-3.
- start | Microsoft Docs
Overview
START
is a command used in Windows CMD to initiate a separate window to run a specified program or command. This utility is useful for running scripts or applications in parallel, allowing multitasking and facilitating more complex workflows.
Syntax
The basic syntax for START
is:
START ["title"] [/D path] [/I] [/MIN] [/MAX] [options] [command/program] [parameters]
"title"
: Specifies the title of the command prompt window where the command is run./D path
: Sets the initial starting directory./I
: Starts with no environment variables./MIN
and/MAX
: Starts the window minimized or maximized, respectively.command/program
: The command or executable program to run.parameters
: Parameters or switches for the specified command.
Options/Flags
/D path
: Sets the startup directory for the command. This is where the command starts executing from./B
: Starts an application without opening a new command prompt window. Direct output to the current shell environment./MIN
and/MAX
: Starts the command in a minimized or maximized window./SEPARATE
and/SHARED
: Starts 16-bit Windows-based programs in separate or shared memory spaces, respectively./WAIT
: Waits for the started program to terminate before proceeding./REALTIME
,/HIGH
,/ABOVENORMAL
,/NORMAL
,/BELOWNORMAL
,/LOW
: Specifies the priority for the command.
Examples
-
Start Notepad:
START notepad
-
Start Notepad minimized with a custom window title:
START "My Notepad" /MIN notepad
-
Open a new CMD with a specific path:
START /D C:\Users\admin cmd
-
Start a program with administrative privileges:
runas /user:administrator "START notepad"
Common Issues
- Path with spaces: When specifying paths or titles with spaces, always enclose them in quotes.
- Command not found: Ensure the command or program’s path is correct and accessible. Use full paths for clarity.
- Administrative Rights: Some commands require elevated permissions. Use
runas
for such cases.
Integration
Combine START
with other commands like tasklist
or taskkill
for managing applications:
-
Starting a program and then finding its process ID:
START notepad tasklist | findstr /i "notepad"
-
Starting multiple instances of a program in separate windows:
START "Instance 1" /D C:\ProgramData\app1 app.exe START "Instance 2" /D C:\ProgramData\app2 app.exe
- CMD: Opens a new instance of the Command Prompt.
- RUNAS: Runs a program with the specified user rights.
- TASKLIST and TASKKILL: Useful for process management in scripts using
START
.
For further reading and more detailed information, refer to the official Microsoft documentation on CMD commands and the START
command here.
- SS64
- CMD
- How-to
Start a program, command or batch script, opens in a new/separate Command Prompt window.
Syntax START "title" [/D path] [options] "command" [parameters] Key: title Text for the CMD window title bar (required.) path Starting directory. command The command, batch file or executable program to run. parameters The parameters passed to the command. Options: /MIN Start window Minimized. /MAX Start window Maximized. /W or /WAIT Start application and wait for it to terminate. (see below) /LOW Use IDLE priority class. /NORMAL Use NORMAL priority class. /ABOVENORMAL Use ABOVENORMAL priority class. /BELOWNORMAL Use BELOWNORMAL priority class. /HIGH Use HIGH priority class. /REALTIME Use REALTIME priority class.
/B Start application without creating a new window. In this case Ctrl-C will be ignored - leaving Ctrl-Break as the only way to interrupt the application. /I Ignore any changes to the current environment, typically made with SET. Use the original environment passed to cmd.exe /NODE The preferred Non-Uniform Memory Architecture (NUMA) node as a decimal integer. /AFFINITY The processor affinity mask as a hexadecimal number. The process will be restricted to running on these processors. Options for running 16-bit Windows programs, on Windows 10 only: /SEPARATE Start in separate memory space. (more robust) 32 bit only. /SHARED Start in shared memory space. (default) 32 bit only.
Always include a TITLE this can be a simple string like «My Script» or just a pair of empty quotes «»
According to the Microsoft documentation, the title is optional, but depending on the other options chosen you can have problems if it is omitted.
If command is an internal cmd command or a batch file then the command processor CMD.exe is run with the /K switch. This means that the window will remain after the command has been run.
In a batch script, a START command without /wait will run the program and just continue, so a script containing nothing but a START command will close the CMD console and leave the new program running.
Document files can be invoked through their file association just by typing the name of the file as a command.
e.g. START «» MarchReport.docx will launch the application associated with the .docx file extension and load the document.
To minimise any chance of the wrong exectuable being run, specify the full path to command or at a minimum include the file extension: START «» notepad.exe
If you START an application without a file extension (for example WinWord instead of WinWord.exe)then the PATHEXT environment variable will be read to determine
which file extensions to search for and in what order.
The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD
Start — run in parallel
The default behaviour of START is to instantiate a new process that runs in parallel with the main process. For arcane technical reasons, this does not work for some types of executable, in those cases the process will act as a blocker, pausing the main script until it’s complete.
In practice you just need to test it and see how it behaves.
Often you can work around this issue by creating a one line batch script (runme.cmd ) to launch the executable, and then call that script with START runme.cmd
Start /Wait
The /WAIT option should reverse the default ‘run in parallel’ behaviour of START but again your results will vary depending on the item being started, for example:
Echo Starting START /wait "job1" calc.exe Echo DoneThe above will start the calculator and wait before continuing. However if you replace calc.exe with Winword.exe, to run Word instead, then the /wait will stop working, this is because Winword.exe is a stub which launches the main Word application and then exits.
A similar problem will occur when starting a batch file, by default START will run the equivalent of CMD /K which opens a second command window and leaves it open. In most cases you will want the batch script to complete and then just close its CMD console to resume the initial batch script. This can be done by explicitly running CMD /C …
Echo Starting START /wait "demojob" CMD /c demoscript.cmd Echo DoneAdd /B to have everything run in a single window.
In a batch file, an alternative is to use TIMEOUT to delay processing of individual commands.
START vs CALL
Starting a new process with CALL, is very similar to running START /wait, in both cases the calling script will (usually) pause until the second script has completed.
Starting a new process with CALL, will run in the same shell environment as the calling script. For a GUI application this makes no difference, but a second ‘called’ batch file will be able to change variables and pass those changes back to the caller.
In comparison START will instantiate a new CMD.exe shell for the called batch. This will inherit variables from the calling shell, but any variable changes will be discarded when the second script ends.
Run a program
To start a new program (not a batch script), you don’t have to use CALL or START, just enter the path/file to be executed, either on the command line or within a batch script. This will behave as follows:
- On the command line, CMD.EXE does not wait for the application to terminate and control immediately returns to the command prompt.
- Running a program from within a batch script, CMD.EXE will pause the initial script and wait for the application to terminate before continuing.
- If you run one batch script from another without using either CALL or START, then the first script is terminated and the second one takes over.
Search order:
- Running a program from CMD will search first in the current directory and then in the PATH.
- Running a program from PowerShell will search first in the PATH and then in the current directory.
- The Windows Run Line (win+r) will search first in App Paths [defined in HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths] and then the PATH
Multiprocessor systems
Processor affinity is assigned as a hex number but calculated from the binary positions (similar to NODRIVES)
Hex Binary Processors
1 00000001 Proc 1
3 00000011 Proc 1+2
7 00000111 Proc 1+2+3
C 00001100 Proc 3+4 etcSpecifying /NODE allows processes to be created in a way that leverages memory locality on NUMA systems. For example, two processes that communicate with each other heavily through shared memory can be created to share the same preferred NUMA node in order to minimize memory latencies. They allocate memory from the same NUMA node when possible, and they are free to run on processors outside the specified node.
start /NODE 1 app1.exe
start /NODE 1 app2.exeThese two processes can be further constrained to run on specific processors within the same NUMA node.
In the following example, app1 runs on the low-order two processors of the node, while app2 runs on the next two processors of the node. This example assumes the specified node has at least four logical processors. Note that the node number can be changed to any valid node number for that computer without having to change the affinity mask.
start /NODE 1 /AFFINITY 0x3 app1.exe
start /NODE 1 /AFFINITY 0xc app2.exe
Running executable (.EXE) files
When a file that contains a .exe header, is invoked from a CMD prompt or batch file (with or without START), it will be opened as an executable file. The filename extension does not have to be .EXE. The file header of executable files start with the ‘magic sequence’ of ASCII characters ‘MZ’ (0x4D, 0x5A) The ‘MZ’ being the initials of Mark Zibowski, a Microsoft employee at the time the file format was designed.
Command Extensions
If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:
Non-executable files can be invoked through their file association just by typing the name of the file as a command. (e.g. example.docx would launch the application associated with the .docx file extension). This is based on the setting in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ext\OpenWithList, or if that is not specified, then the file associations — see ASSOC and FTYPE.
When executing a command line whose first token is the string CMD without an extension or path qualifier, then CMD is replaced with the value of the COMSPEC variable. This prevents picking up CMD.EXE from the current directory.
When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the COMSPEC environment variable. This prevents picking up CMD.EXE from the current directory.
When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD Notice the syntax is the same as the PATH variable, with semicolons separating the different elements.
When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name. If it does, the START command launches the Explorer on that path. If done from the command line, it is the equivalent to doing a CD /D to that path.
Errorlevels
If the command is successfully started ERRORLEVEL =unchanged, typically this will be 0 but if a previous command set an errorlevel, that will be preserved (this is a bug).
If the command fails to start then ERRORLEVEL = 9059
START /WAIT batch_file — will return the ERRORLEVEL specified by EXIT
START is an internal command.
Examples
Start a program in the current directory:
START «Demo Title» example.exe
Start a program giving a fulll path:
START «Demo 2» /D «C:\Program Files\ACME Corp\» «example.exe»
Alternatively:
START «Demo 2» «C:\Program Files\ACME Corp\example.exe»
or:
CD /d «C:\Program Files\ACME Corp\»
START «Demo 2» «example.exe»
Start a program and wait for it to complete before continuing:
START «Demo 3» /wait autocad.exe
Open a file with a particular program:
START «Demo 4» «C:\Program Files\Microsoft Office\Winword.exe» «D:\Docs\demo.txt»
Run a minimised Login script:
CMD.exe /C START «Login Script» /Min CMD.exe /C Login.cmd
In this example the first CMD session will terminate almost immediately and the second will run minimised.
The first CMD is required because START is a CMD internal command. An alternative to this is using a shortcut set to open minimised.
Open Windows Explorer and list the files in the current folder (.) :
C:\any\old\directory> START .
Open a webpage in the default browser, note the protocol is required (https://):
START
https://ss64.com
Open a webpage in Microsoft Edge:
%windir%\explorer.exe microsoft-edge:https://ss64.com
or with a hard-coded path:
«C:\Program Files (x86)\Microsoft Edge\Application\msedge.exe»https://ss64.com"%windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" https://ss64.com
Connect to a new printer: (this will setup the print connection/driver):
START \\print_server\printer_name
Start an application and specify where files will be saved (Working Directory):
START /D C:\Documents\ /MAX «Maximised Notes» notepad.exe
“Do not run; scorn running with thy heels” ~ Shakespeare, The Merchant of Venice
Related commands
WMIC process call create «c:\some.exe»,»c:\exec_dir» — This method returns the PID of the started process.
CALL — Call one batch program from another.
CMD — can be used to call a subsequent batch and ALWAYS return even if errors occur.
TIMEOUT — Delay processing of a batch file/command.
TITLE — Change the title displayed above the CMD window.
RUN commands Start ➞ Run commands.
How-to: Run a script — How to create and run a batch file.
How-to: Autoexec — Run commands at startup.
ScriptRunner — Run one or more scripts in sequence.
Q162059 — Opening Office documents.
Equivalent PowerShell: Start-Process — Start one or more processes.
Equivalent bash command (Linux) : open — Open a file in it’s default application.
Equivalent macOS command: open — Open a file in a chosen application.
Copyright © 1999-2025 SS64.com
Some rights reserved
-
What is the
START
Command? -
Basic Syntax of the
START
Command -
Example 1: Opening Notepad
-
Example 2: Opening a URL in the Default Browser
-
Example 3: Running Multiple Commands
-
Example 4: Using START with File Paths
-
Example 5: Starting a Program with Parameters
-
Conclusion
-
FAQ
When it comes to automating tasks in Windows, Batch Scripts are incredibly powerful tools. One of the most useful commands in Batch Scripting is the START command. This command allows you to open applications, documents, or even new command prompt windows, all from a simple script. Whether you’re looking to streamline your workflow or just want to learn a new scripting technique, understanding how to effectively use the START command can significantly enhance your automation capabilities.
In this tutorial, we’ll delve into various ways to utilize the START command in Batch Scripts, providing you with practical examples and explanations to ensure you’re fully equipped to implement it in your projects.
What is the START
Command?
The START command in Batch Scripts is a versatile command that allows users to launch applications or files in a new window. It can be particularly handy when you want to run multiple programs simultaneously or when you need to execute a command without interrupting the current command prompt session. By using the START command, you can enhance the efficiency of your scripts, making them more dynamic and user-friendly.
Basic Syntax of the START
Command
Before we dive into examples, it’s important to understand the basic syntax of the START command. The general format is:
START ["Title"] [options] "path_to_executable_or_file"
Title
: This is an optional parameter that specifies the title of the new window.Options
: These can include various flags like/MIN
to minimize the window or/WAIT
to wait for the program to finish before continuing.Path
: This is the path to the executable or file you want to open.
Understanding this syntax will help you effectively utilize the START command in your Batch Scripts.
Example 1: Opening Notepad
One of the simplest uses of the START command is to open Notepad from a Batch Script. Here’s how you can do it:
@echo off
START notepad.exe
In this example, the script uses the @echo off
command to prevent the commands from being displayed in the command prompt. The START notepad.exe
command then launches Notepad in a new window. This is a straightforward way to open applications without blocking the command prompt.
Example 2: Opening a URL in the Default Browser
You can also use the START command to open a URL in your default web browser. This can be particularly useful for automating web-related tasks. Here’s an example:
@echo off
START https://www.example.com
In this script, the command START https://www.example.com
opens the specified URL in the default web browser. This is especially handy for scripts that require web access, allowing users to quickly navigate to relevant sites without manual input.
Example 3: Running Multiple Commands
The START command can also be used to run multiple commands simultaneously. Here’s a script that demonstrates this:
@echo off
START notepad.exe
START cmd.exe /K echo Hello, World!
In this example, the script starts Notepad and then opens a new command prompt window that displays “Hello, World!” using the /K
option. This allows for running multiple processes at once, making your scripts more efficient and interactive.
Example 4: Using START with File Paths
You can also use the START command to open files directly. Here’s how:
@echo off
START "" "C:\path\to\your\file.txt"
In this case, the script opens a text file located at the specified path. The empty quotes ""
are used to designate the window title, which is optional. This is useful for quickly accessing files without needing to navigate through folders manually.
Example 5: Starting a Program with Parameters
Sometimes, you may need to start a program with specific parameters. Here’s an example of how to do this:
@echo off
START "" "C:\path\to\your\program.exe" --option1 --option2
In this script, the program specified will launch with the given options. This is particularly useful for applications that support command-line arguments, allowing for greater control over how they run.
Conclusion
The START command in Batch Scripts is a powerful tool that can significantly enhance your automation capabilities. From opening applications to running multiple commands simultaneously, understanding how to use this command effectively can streamline your workflow and make your scripts more dynamic. By experimenting with the various examples provided, you can tailor the START command to fit your specific needs, ultimately improving your efficiency and productivity. Whether you’re a novice or an experienced scripter, mastering the START command will undoubtedly add value to your Batch Scripting toolkit.
FAQ
-
What does the START command do in Batch Scripts?
The START command launches applications or files in a new window, allowing for simultaneous execution of multiple processes. -
Can I use the START command to open websites?
Yes, you can use the START command to open URLs in your default web browser. -
How do I run multiple commands with the START command?
You can run multiple commands by using separate START commands for each application or file you want to launch. -
Is it necessary to use quotes in the START command?
Quotes are used for paths with spaces or to specify window titles, but they are optional for simple commands without spaces. -
Can I pass parameters to programs using the START command?
Yes, you can pass parameters to programs by including them after the program’s path in the START command.
Enjoying our tutorials? Subscribe to DelftStack on YouTube to support us in creating more high-quality video guides. Subscribe