Windows common commands (Advanced statement)

Source: Internet
Author: User
  • Variable operation:
    定义变量:set  val=abc提示输入变量:set  /p  val=请输入变量:val替换:set  val=%val:a=b%  #把变量%val%中的a替换成b截取:set  val=%val:~0,3%  #截取val的前3位计算:set  /a  a=%b%+1  #设置变量a的值为变量b+1
  • Judgment statement:
    A. Syntax:
    if  条件  (    逻辑)  else  (    逻辑)

    B. Conditions:

    判断字符串是否相等:"字符串1"=="字符串2"判断数值是否相等:数值1  equ  数值2判断文件/文件夹是否存在:exist 文件名判断变量是否已定义:defined  变量判断上个语句的返回值:%errorlevel%  #为0执行成功,否则执行失败
  • Loop statement:
    A. Syntax:
    B. Usage:
  • Windows common commands (Advanced statement)

    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.