Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running vi in adb under Windows

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)?

like image 645
Chinmay Kanchi Avatar asked Jul 10 '12 21:07

Chinmay Kanchi


People also ask

How do I run adb on Windows?

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.


3 Answers

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).

like image 89
Les Avatar answered Oct 15 '22 13:10

Les


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:

  • Select Adb as Connection type
  • Enter -d (for single usb device) or device serial number in the host field
  • ???
  • PROFIT!!!

PuTTYTray configuration

like image 30
Idolon Avatar answered Oct 15 '22 13:10

Idolon


I've never had your exact problem, but it seems like Cygwin would be a good bet.

like image 43
strange quark Avatar answered Oct 15 '22 13:10

strange quark