Reputation: 19
I'm working on a project (I'm begginer) where I need to run the speedtest-go command on my Android device via Termux and then download the result to my PC using PowerShell and ADB. Here’s what I’m trying to achieve:
Start Termux on the non-rooted Android device (Samsung S24 Ultra). Run the speedtest-go command within Termux and redirect the output to a file on the device. Pull the result file from the Android device to my Windows PC using ADB. I have the following setup:
PowerShell running on Windows. ADB installed and configured. Termux with speedtest-go installed on my Android device. Here is a sample PowerShell script I've been working on:
Simply (not working powershell script) `# Launch Termux ./adb shell monkey -p com.termux -c android.intent.category.LAUNCHER 1 Start-Sleep -Seconds 10 # Wait for Termux to launch
./adb shell input text "speedtest-go > /sdcard/speedtest_result.txt" #The \ does not help Start-Sleep -Seconds 10 # Wait for command input ./adb shell input keyevent 66 # Simulate Enter key press
Start-Sleep -Seconds 60
./adb pull /sdcard/speedtest_result.txt C:\Users\User\Desktop\platform-tools-latest-windows\platform-tools\Speedtest
Write-Output "File saved: C:\Users\User\Desktop\platform-tools-latest-windows\platform-tools\Speedtest" Issues: ` The adb shell input text command does not seem to correctly handle the redirection (>), and I am unsure how to correctly format the input command to achieve redirection in Termux. I'm also unsure if there are better practices or more efficient ways to handle this process. Also I faced problems with permissions (termux is using other user then adb shell). Questions:
How can I correctly run the speedtest-go command in Termux and redirect the output to a file using ADB and PowerShell? Are there improvements I can make to this script to ensure it works correctly? Or any easier way to measure DL UL TP on android phone and redirect output to Windows? Any help or suggestions would be greatly appreciated!
Thanks in advance!
[Expectations]
Script should run Termux on android phone - correct Script should start the speedtest-go - correct Script should redirect output to .txt file - failed Later the .txt should be pulled to Windows.
Upvotes: 1
Views: 49