Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Call command in dos

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to use the Call command in dos. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Call

Calls from one batch program to another without terminating the parent batch program. The call command accepts the label that is used as the target of the call. If you use Call outside of a script or batch file, it will not work on the command line.

Grammar

Call [[Drive:] [Path] FileName [BatchParameters]] [: label [arguments]]

Parameters.

[Drive:} [Path] FileName

Specifies the location and name of the batch program to be called. The filename parameter must have a .bat or .cmd extension.

BatchParameters

Specify any command line information required by the batch program, including command line options, file names, batch parameters (from% 0 to% 9), or variables (for example,% baud%).

: label

Specifies the label to which the batch program jumps. Use the call command with this parameter to create a new batch file context and give control to the statement after the specified label. When the end of the batch file is first encountered (after jumping to the tag), control is returned to the statement after the CALL statement. The second time you encounter the end of the batch file, the batch script will be exited. For instructions on the goto: eof command extension that allows you to return from a batch script, see ".

Arguments

For batch programs that start with: label, specify the command line information to pass to its new instance, including command line options, file names, batch parameters (from% 1 to% 9), or variables (such as% baud%).

/?

Displays help at the command prompt.

Annotation

Use batch parameters

Batch parameters can contain any information passed to the batch program, including command line options, file names, batch parameters (from% 1 to% 9), or variables (for example,% baud%). For more information about batch parameters, see.

Use pipes and redirect symbol

Do not use pipes and redirection symbols in the call command.

Issue a recursive call

You can create a batch program that calls itself, but you must provide an exit condition. Otherwise, the parent and child batch programs can loop indefinitely.

Use command extension

If command extension is enabled (that is, by default), call accepts the label parameter as the target of the call. The correct syntax is as follows:

Call: label arguments

For more information about enabling and disabling command extensions, see cmd in ".

Example

To run the Checknew.bat program from another batch program, type the following command in the parent batch program:

Call checknew

If the parent batch program accepts two batch parameters and wants it to pass them to Checknew.bat, you can use the following command in the parent batch program:

Call checknew 1 2

The above is all the contents of the article "how to use Call commands in dos". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report