Skip to content

Instantly share code, notes, and snippets.

@GiowGiow
Last active December 4, 2022 04:11
Show Gist options
  • Select an option

  • Save GiowGiow/30722bdc2b9574ac807ef04ba54ca74a to your computer and use it in GitHub Desktop.

Select an option

Save GiowGiow/30722bdc2b9574ac807ef04ba54ca74a to your computer and use it in GitHub Desktop.
Droidcam Automated Powershell Script - power on android screen, open droidcam app and start droidcam on PC
# This script needs:
# A Android with root (strongly recommended) to auto accept ADB connection using PC keys
# ADB.exe on PC - it comes with android studio
# Droidcam on PC
# How to auto accept adb connection using PC keys:
# https://stackoverflow.com/questions/30178911/how-to-authorize-and-accept-adb-rsa-key-with-broken-touch-screen-on-android
$AdbPath = "C:\Users\gioma\AppData\Local\Android\sdk\platform-tools\adb.exe"
$DroidCamPath = "C:\Program Files (x86)\DroidCam\"
$DroidCamExe = $DroidCamPath + "DroidCamApp.exe"
# You can check the android serial using Droidcam usb list
$AndroidSerial = ""
# Press power button if the phone is dozing
& $AdbPath "shell" "(dumpsys power | grep mWakefulness=Dozing > /dev/null)" "&&" "input keyevent 26"
# Open the DroidCam App (remove the trailing x if you don't have the paid droidcam version)
& $AdbPath "shell" "am" "start" "-n" "com.dev47apps.droidcamx/com.dev47apps.droidcamx.DroidCamX"
# Wait 1 sec to open the app on Android
Start-Sleep 1
# Start DroidCam client on PC
Start-Process -WorkingDirectory $DroidCamPath $DroidCamExe "usb $AndroidSerial 4747"
' This script is to silently call the first one, make a shortcut of it, you can even set an icon to make it pretty
' Create a shortcut to this file and make it run with wscript.exe ex:
' wscript.exe path/to/this/file
Dim shell,command
command = "powershell.exe -nologo -command "".\droidcam.ps1"""
Set shell = CreateObject("WScript.Shell")
shell.Run command,0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment