adb 设置手机不息屏

手机不熄屏设置


$cmds = @()
$cmds += "shell settings put global stay_on_while_plugged_in 3"
$cmds += "shell settings put system screen_off_timeout 2147483647"
$cmds += "shell svc power stayon true"
$cmds += "shell locksettings set-disabled true"

[string[]]$deviceIds = .\adb.exe devices | Select-String '.*(?=\t)' | ForEach-Object { ($_.Matches.Value) }
$count = $deviceIds.Length
$current = $count

$deviceIds | % {

    $current -= 1
    Write-Host "$_ $current - $count"   -ForegroundColor Green

    foreach($cmd in $cmds){

        $command = ".\adb.exe  -s $_  $cmd"
        Write-Host $command
        Invoke-Expression $command
    }
}

Write-Host "完成"   -ForegroundColor Green
上一篇
下一篇