131

How do I halt an android phone using adb command? I can reboot, but I don't know how to halt.

I tried shutdown -k wait command, but it did not work.

rmtheis
  • 103
  • 1
Blacklist Human
  • 1,521
  • 4
  • 12
  • 6

6 Answers6

191

Try adb shell reboot -p to shutdown the phone.

geffchang
  • 17,763
  • 18
  • 60
  • 74
32

Note: All the following commands below require root access.

On Android Oreo, this works and does a graceful shutdown:

adb shell su -c 'am start -a com.android.internal.intent.action.REQUEST_SHUTDOWN'
adb shell su -c 'am start -n android/com.android.internal.app.ShutdownActivity'  #alternative; the aforesaid intent is supposed to be passed to this component under normal circumstances, but calling the component alone works too
adb shell su -c 'svc power shutdown'       # alternative; tested on Android 5.0, 6.0.1 and 8.1.0

Following is an alternative and is tested on Android 4.2, 5.0 and 6.0.1. I do not know about Nougat but it doesn't work for Oreo though.

adb shell su -c 'am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN --ez KEY_CONFIRM true --activity-clear-task'   # I kept this here for historical purposes only.

For low-level and instant shutdown

If you're running Android KitKat or above* and have root access, you can try this command:

adb shell su -c 'setprop sys.powerctl reboot,recovery'
  • replace su -c with adb shell to run the command using
  • replace reboot,recovery with reboot to reboot the device
  • replace reboot,recovery with shutdown to shutdown the device

* The last version on which the command is tested upon is stock Android 6.0.1.

Firelord
  • 25,528
  • 21
  • 129
  • 295
6

Here is another method - go to Android's shell, then shutdown the phone:

adb shell
shutdown

Using C:\Windows\system32\cmd.exe:

Microsoft Windows [Version 6.3.9600]
<c> 2013 Microsoft Corporation. All rights reserved.

C:\Users\Mahdi> adb shell root@android:/ # shutdown shutdown

Mahdi Rashidi
  • 169
  • 1
  • 2
4

In the Windows Subsystem for Android (WSA) shutdown doesn't work. Instead, try doing

adb shell reboot -p

or

adb shell
reboot -p
PS E:\platform-tools> .\adb.exe devices
List of devices attached
localhost:58526 device

PS E:\platform-tools> .\adb.exe shell windows_x86_64:/ $ shutdown /system/bin/sh: shutdown: inaccessible or not found 127 windows_x86_64:/ $ reboot -p Done windows_x86_64:/ $ PS E:\platform-tools> .\adb.exe devices List of devices attached localhost:58526 offline

pro_nav
  • 71
  • 5
0

To shutdown the phone use this command on PC:

adb shell halt
Firelord
  • 25,528
  • 21
  • 129
  • 295
-1

Try

adb shell "input keyevent 26"

It works for me.

Andrew T.
  • 16,898
  • 10
  • 77
  • 134