-
Notifications
You must be signed in to change notification settings - Fork 0
/
record.bat
74 lines (57 loc) · 2.37 KB
/
record.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
goto :Code
==============================================================================
RECORD.BAT
Usage:
Only the first parameter is used and should be an integer>=0
%1>0 will record video for that many number of seconds (mp4)
%1==0 will take a screenshot (png)
The file name created will be named based on the time the file is pulled
from the device.
Instructions:
1) On the device, ensure that Enable USB Debugging is checked in Developer Options section of the settings.
2) Connect your device
3) In the console, type "adb devices" to make sure you can connect to the device
4) Enjoy!
==============================================================================
==============================================================================
:Code
adb devices
if %1==0 (
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "screen.png" %%d-%%e-%%f.png
) else (
adb shell screenrecord --time-limit %1 --bit-rate 6000000 /sdcard/demo.mp4
adb pull /sdcard/demo.mp4
adb shell rm /sdcard/demo.mp4
for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "demo.mp4" %%d-%%e-%%f.mp4
)
goto :End
=============================================================================
==============================================================================
:: MORE NOTES:
:: If you want to disconnect from USB, you can connect ADB via wireless:
:: First, connect to USB as normal:
:: Get the WIFI ip address. There are a couple ways to do this:
:: GET IP ADDRESS:
:: List the nics on the device. You can find the ip address for the wlan there.
adb shell netcfg
:: LISTEN ON A PORT:
:: Have the device listen on port 5555:
adb tcpip 5555
:: Disconnect the device from USB:
:: Connect ADB to the device via the IP address:
adb connect <device-ip-address>
:: Confirm you are connected:
adb devices
:: If the adb connection is ever lost:
:: 1 - Make sure that your host is still connected to the same Wi-Fi network your Android device is.
:: 2 - Reconnect by executing the "adb connect" step again.
:: 3 - Or if that doesn't work, reset your adb host:
adb kill-server
:: and then start over from the beginning:
=============================================================================
==============================================================================
:End