Very occasionally, I will want to edit a file, say /system/build.prop or /etc/hosts on my Android device. I find that the easiest way to do it is:
c:\> adb shell
$ su
# vi /etc/hosts
This works fine if I'm using Linux. However, attempting to run vi on my phone when using Windows results in a borked vi screen with strange characters. I'm assuming this is because cmd
doesn't support ANSI control characters.
Is there any way to fix this (e.g., a cmd alternative that does the job)?
Open a command window in the folder by holding shift and right-clicking in an empty spot in the folder and selecting "Open command prompt/PowerShell here" in the menu. Then you can start using ADB — connect your phone and try . ADB devices to see if it's working. A list with attached devices should show up.
This is a late answer to your question in 2012. I found that if I run Windows PowerShell, I can do "vi" under the adb shell.
Launch PowerShell (use your Android SDK location, not mine)
PS C:\Users\Me> cd Downloads\Android\Sdk\Platform-Tools
PS C:\Users\Me\Downloads\Android\Sdk\Platform-Tools> .\adb shell
root@vbox86p:/ # cd data/data/com.mycorporation.myproj/shared_prefs
root@vbox86p:/data/data/com.mycorporation.myproj/shared_prefs # vi log_prefs
I only used simple vi commands like 'o', 'esc', and ':wq', but it worked well using the full screen (none of the garbage you would see in the Windows Command Prompt).
You can do it with PuTTYTray. It's an improved version of PuTTY which features a number of additional features. One of such feature is Android adb support. To use it:
Adb
as Connection type -d
(for single usb device) or device serial number in the host fieldI've never had your exact problem, but it seems like Cygwin would be a good bet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With