在创建一个文件,并设置为文件名为xxx.bat(.bat是window的可运行脚本–就是可以用命令行直接运行)
睡眠命令:rundll32 powrprof.dll,SetSuspendState
睡眠.bat 文件编辑把上面命令复制上去即可
关机命令:Shutdown -s -t 1
(意思为1s后关机)
关机.bat 文件编辑把上面命令复制上去即可
指定时间睡眠命令:at 12:00 rundll32 powrprof.dll,SetSuspendState(12:00代表指定时间12点睡眠)
指定时间关机命令:at 12:00 shutdown -s
取消关机命令:shutdown -a
循环定时执行某些任务
@echo off
::@echo off 窗口命令行不再显示命令 ::代表注释
::choice延时 /t 秒
set INTERVAL=10
set hour=18
set minute=00
echo start_end_%hour%:%minute%
:: interval(间隔) 这个单位为秒 timeout 等待多少秒
::timeout %INTERVAL% %time:~0,2%从0位开始取2位数
:Again
::cls
if %time:~0,2%==%hour% (if %time:~3,2%==%minute% goto dosomething )
::指定某个时间做 dosomething任务 其余时间每10s循环:Again标签内任务
echo doing_something
if %time:~4,1%==0 cls
::timeout %INTERVAL%
choice /t %INTERVAL% /d y /n >nul
goto Again
:dosomething
echo dosomething
恶搞人的.bat
Option Explicit
On Error Resume Next
Dim answer
Dim WshShell
set WshShell = CreateObject("wscript.Shell")
WshShell.Run "Shutdown -s -t 60",0
WshShell.Run "Shutdown /f /s /t 60 /c 输入'hello world',否则60秒后关机~",0
Do While answer<>"hello"
answer=InputBox("输入'hello',否则60秒后关你的机~","呵呵",,7000,8000)
Loop
WshShell.Run "Shutdown /a",0
MsgBox "hi hi",,"hello"
编译apk命令行(需要配置gradle环境)
#卸载apk 包名
adb uninstall com.xxx.xxx
::进入项目文件
cd /d D:\AndroidProject\xxx
::杀掉java.exe进程
::taskkill /im java.exe /f
::清理缓存build文件 并运行代码
gradle clean & gradle run
::执行完命令行不关闭窗口
pause
::gradle 编译 gradle run 会编译并安装并启动app
::gradle :app:assembleOldmodelsDebug
::gradle 编译并安装apk cmd /k(不关闭命令行)
::cmd /k gradle installDebug