BAT Common Commands

Source: Internet
Author: User

1. Modify the cmd form size

Mode con cols=70 lines=30

2. Modify the color of the form

color [FB]

F is the foreground color, that is, the font color

b is the background color, that is, the cmd window background color

Background list of colors and values:

0 1 2 3 4 5 6 7 8 9 A B C D E F
Black Blue Green Lake Blue Red Purple Yellow White Grey Light Blue Light Green Shallow Green Light Red Light Purple Light Yellow Bright White

3. Print: Echo Something

echo off not print Run command, direct Print command run results, for the line under it is useful.

echo on--Prints the command to be run before printing the command to run the result, which is useful for the rows below it.

@ echo HelloWorld: Do not print this command, directly print the command to run the results, and only useful to the bank.

4. Set Variable: Set Val=value

The calling variable is%val%.

5. New folder: MkDir newfoldername

6. Delete folder: rd/s/q

/s: In addition to the directory itself being deleted, all subdirectories and files under the specified directory are deleted, which is used to delete the directory tree.

/Q: Quiet mode, with/s delete directory tree without requiring confirmation, delete directly.
7. For loop:

@for/L%%i in (1,1,3) do (
echo the value of I is:%%i
)

For loop details refer to: http://blog.csdn.net/pigchan/article/details/5066098

8. Find: Search command

Find "I/activitymanager" Log.txt|find "Displayed com.qiyi.video/. Welcomeactivity ">> ActivityManager.log

Find detailed commands can be consulted: http://www.jb51.net/article/18987.htm

9. Write files

echo HelloWorld > Test.txt new Test.txt and writes to Hellowworld, overwriting writes if Test.txt already exists.

echo HelloWorld >> test.txt new Test.txt and writes to Hellowworld, append if test.txt already exists.

BAT Common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.