问题
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)?
回答1:
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
Adbas Connection type - Enter
-d(for single usb device) or device serial number in the host field - ???
- PROFIT!!!
回答2:
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).
回答3:
I've never had your exact problem, but it seems like Cygwin would be a good bet.
回答4:
What you basically need is a real commandline... Unix-style tools on Windows? MinGW http://www.mingw.org/ is a alternative to Cygwin that's worth looking into.
来源:https://stackoverflow.com/questions/11421955/running-vi-in-adb-under-windows