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

What are the common DOS commands that are often used to apply dos batch files

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "what are the commonly used DOS commands that are often used in dos batch files?" in the actual case of the operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

Echo, @, call, pause, and rem are the most commonly used commands for batch files, so let's start with them. Echo indicates the characters after this command is displayed

Echo off means that all commands that run after this statement do not display the command line itself

@ is similar to echo off, but it is added first to the other command lines, indicating that the command line itself is not displayed at run time.

Call calls another batch file (if another batch file is called directly, subsequent commands of the current file cannot be executed after that file is executed)

Pause running this sentence will pause and display Press any key to continue... Wait for the user to press any key before continuing

Rem indicates that the character after this command is an interpretation line, which is not executed, but is only used for future search.

Example: edit the a.bat file with edit, enter the following contents and save it to c:\ a.bat. After executing the batch file, you can write all the files in the root directory to a.txt, start UCDOS, enter WPS and other functions.

The contents of the batch file are as follows: the file represents:

Echo off does not display the command line

Dir c:\ *. * > a.txt writes the list of files on disk c to a.txt

Call c:\ ucdos\ ucdos.bat calls ucdos

Hello, echo. Display "Hello".

Pause pauses and waits for the button to continue

Rem using wps annotations will use wps

Cd ucdos enters the ucdos directory

Wps uses wps

Parameters can also be used in batch files like the C language, which requires only one parameter representation%.

% represents a parameter, which is a string added to the file name when running a batch file. Variables can range from% 0 to% 9jue% 0 to represent the file name itself, and strings are represented in the order from% 1 to% 9.

For example, C: under the root directory, the batch processing file name is f.bat and the content is format% 1

Then if you execute C:\ > f a:, what is actually executed is format a:

Another example is C: the name of the batch file under the root directory is t.bat, and the content is type% 1 type% 2.

Then running C:\ > t a.txt b.txt will display the contents of the a.txt and b.txt files sequentially

This is the end of the content of "what are the common DOS commands that are often used in applying dos batch files?" Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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