so I'm trying to run some ADB commands through a powershell script.
This is a simple example of what I am trying to do:
adb shell "
echo "in adb shell"
su root
echo "you are now root."
ls
cd /data/data
echo "in /data/data"
ls
"
I saw in a previous post to add the "" next to shell and at the bottom but that still didn't work for me. I can start the shell and the first ls works. but it just prints the rest of the commands out instead of doing them. The output I am getting looks like:
PS C:\Scripts> & .\test.ps1
: not found/sh:
in adb shell
su root
echo you are now root.
ls
cd /data/data
echo in /data/data
MSM8960_lpm.rc
acct
cache
.
.
.
ueventd.qcom.rc
ueventd.rc
vendor PS C:\Scripts>
Any help would be greatly appreciated. Thanks in advance!
Note: the path to ADB is within the powershell $env:path so the adb commands are working
I was able to get around this by doing:
adb shell "su -c '[cmd]; [cmd]' "