命令行执行单个脚本
1、打开命令提示符

2、进入脚本路径
D:
cd D:\code\aixin
airtest run login.air
批量顺序执行多个脚本
1、新建txt文件
::关闭回显
@echo off
::切换到D盘
D:
::进入D盘的test目录
cd D:\code\aixin
::执行 airtest run 命令
title 正在执行login脚本
airtest run login.air
::执行完第一个脚本后停留10s
ping 127.0.0.1 -n 10 >nul
title 正在执行logout脚本
airtest run logout.air
exit
注:需要在脚本中添加设备

2、保存文件
选择另存为,将编码更改为ANSI(为了命令提示title不为乱码)


3、重命名 .txt 文件
将文件后缀改为.bat
知识点
1、其中 ::xxx 表示的是注释内容,可以不写入 .txt 文件中
2、@echo off 关闭回显,即在命令窗口中不显示@echo off及脚本之后的命令
具体理解可参考文章:https://blog.csdn.net/wangjiayu520/article/details/84526991
3、**title xxx **用来指定命令提示窗口的标题,可以让我们清晰地看出当前是在执行第几个脚本。

网友评论