需要固定时间间隔比如5秒运行一个文件,网上查了下最简单的就是用goto
语句,如果不加延时那就是死循环,在里面加上延时语句choice /t 5 /d y /n >nul
。下面的批处理作用就是每隔5秒屏幕上输出一次jajaja。
@echo off
:start
echo jajaja
choice /t 5 /d y /n >nul
goto start
此外,nircmd这个程序不错,如:
nircmd.exe sendmouse left click
更多介绍:
NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line option, you can write and delete values and keys in the Registry, write values into INI file, dial to your internet account or connect to a VPN network, restart windows or shut down the computer, create shortcut to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more...