Call command in Windows
The call command calls a batch program from another program without stopping the original batch program. The call command accepts the label as its target.
Note : The call command is not valid at the command prompt, when it is used outside the script or executable file.
Call command in Windows
- Syntax
- Parameters
- The batch parameter
- Note
- Use batch parameter
- Use Label parameter
- Use the symbol (|) and navigation icon
- Perform a recursive call command
- Work with command extensions
- For example
Syntax
call [Drive:] [Path] [] [:
Parameters
ParametersDescription [:] [] Specifies the location and name of the batch program you want to call. The FileName parameter is required and must have a .bat or .cmd extension. Specify any command line information required by the batch program. : Specify the label to which you want the batch program control to be transferred. Specifying the command line information will be transferred to the new object in the batch program, starting at : Label. /? Show help at the command prompt.The batch parameter
The reference for batch scripts (% 0,% 1, .) is listed in the following table.
% * in batch script refers to all arguments (eg: % 1,% 2,% 3 .)
You can use the following optional syntax to replace batch parameters (% n):
Batch parameter Description% ~ 1 Expand % 1 and remove the surrounding quotation marks (""). % ~ f1 Expand % 1 to qualified path. % ~ d1 Only expand % 1 to drive letter. % ~ p1 Only expanded % 1 to path. % ~ n1 Only expand % 1 to a file name.% ~ x1 Expand only % 1 file name extension. % ~ s1 Expand % 1 to a qualified path containing only short names. % ~ a1 Expand % 1 to file attribute. % ~ t1 Expand % 1 to the date and time of the file. % ~ z1 Expand % 1 to the size of the file. % ~ $ PATH: 1 Search for the directories listed in the PATH environment variable and expand % 1 to the full name of the first directory found. If the environment variable name is not defined or the file is not found, this modifier will expand to an empty string.
The following table shows how you can combine modifiers with batch parameters to produce the following concatenation results:
Batch parameter with modifier Description% ~ dp1 Only expand % 1 to drive letter and path. % ~ nx1 Only expand % 1 to file name and extension. % ~ dp $ PATH: 1 Search for the directories listed in the PATH environment variable for % 1, and then expand to the drive letter and path of the first directory found. % ~ ftza1 Expand % 1 to display the output similar to the dir command .In the above examples, % 1 and PATH can be replaced with other valid values. The syntax % ~ is ended with a number of valid arguments. Cannot use modifiers % ~ with % *.
Note
Use batch parameter
The batch parameters can contain any information that you can convert to a batch program, including command line options, file names, batch parameters from% 0 to% 9 and variables (eg% baud%).
Use Label parameter
By using the call command with the Label parameter, you will create a new context for the batch file and pass control to the command after the specified label. The first time the executable file ends (that is, after jumping to label), a statement is returned after the call statement. The second time the executable file ends, the batch script will exit.
Use the symbol (|) and navigation icon
Do not use characters (|) and navigation symbols () with the call command.
Perform a recursive call command
You can create a batch program that calls itself. However, you must provide an exit condition. Otherwise, the original batch programs and subroutines can form non-stop loops.
Work with command extensions
If the command extension is enabled, the call command accepts the label as the target of the command. The syntax is exactly as follows:
call:
For example
To run Checknew.bat from another batch program, type the following command into the original batch program:
call checknew
If the original batch accepts two batch parameters and you want it to pass those parameters to Checknew.bat, type the following command in the original batch program:
call checknew% 1% 2
See more:
- The command nfsadmin in Windows
- The ntbackup command in Windows
- Nslookup command in Windows
You should read it
- How to call video call on Zalo PC
- How to call, video Facebook Messenger on mobile, tablet
- Zalo allows direct calling from contacts
- Free Conference Call - Download Free Conference Call here.
- 2 steps to make video calls on Facebook
- How to schedule a call on Skype
- Viettel sim has waves but cannot call, causes and ways to overcome
- 3 easy ways to record calls on iPhone
May be interested
- Rem command in Windowsthe rem command helps write comments (comments) in a batch file or config.sys.
- Instructions for using Command Promptdeep in windows is a command-line world that is obscure. in this article, we will show you how to solve errors and make your computer more secure.
- Rd command in Windowsthe rd command helps delete a directory
- Cmd command in Windowsthe cmd command starts a new version of the command interpreter, cmd.exe. if used without parameters, cmd will display copyright information and the version of the operating system.
- How to use the command history function in Command Promptcommand prompt is an extremely familiar command for anyone using windows operating system. besides, a lot of current software also supports the command line to perform actions on the command prompt window, instead of on the screen.
- The sfc command in Windows(applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012)
- Reg command copy in Windowsto copy an entry to the location specified on the local pc or the remote computer we will use the reg copy command. to learn more about how to use the reg copy command, you can track the syntax, explain the command parameters and the example tipsmake.com has compiled below.
- Fc command in Windowsthe fc command compares two files or a collection of files and displays the differences between them.
- The echo command in Windowsthe echo command displays the message or turns on / off the command repeat feature. if used without parameters, the echo command will display the current echo setting.
- Xcopy command in Windowsthe xcopy command is a command prompt command used to copy one or more files or folders from one location to another. with many options and the ability to copy entire directories, the xcopy command is similar to, but much more powerful, than the copy command.