How to add shortcut letters or words in Android Studio's Terminal for frequent commands?

荒凉一梦 提交于 2021-02-11 04:59:39

问题


In Android Studio's Terminal window, I use some commands too frequently and it's a lot frustrating.

The commands I use a thousand times a day are:

adb kill-server

adb connect 192.168.43.1

While Android Studio is not restarted yet, when you type these once, you can use up and down arrow keys to select them.

But the problem is that I restart AS or switch between projects so many times a day. And writing these commands over and over again is such a pain.

So I thought why don't we create one-letter shortcuts for these?!

For example, for the command adb connect 192.168.43.1 I only want to type c and hit the Enter. And for the other one I want to type just k.

How can we achieve that?


回答1:


Follow these steps:

1) Go to the root folder of adb.exe:

Hold Ctrl+Shift+Esc to open the Task Manager, and in the "Details" tab, right click on adb.exe and select "Open file location":

2) In that directory create a new Text Document and change its name to the shortcut letter you want and change the extension from txt to bat. i.e k.bat:

3) Now open the file in Notepad or just right click on it and select Edit, then type your command and save it and close it:

You can do the step 2 and 3 for other commands too. i.e c.bat, just be careful not to name them similar to already defined commands.

Now if you go back to the Terminal you can just write k or c and hit the Enter.



来源:https://stackoverflow.com/questions/52607585/how-to-add-shortcut-letters-or-words-in-android-studios-terminal-for-frequent-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!