如何在Android Studio的终端中为常用命令添加快捷方式字母或单词? [英] How to add shortcut letters or words in Android Studio's Terminal for frequent commands?

查看:115
本文介绍了如何在Android Studio的终端中为常用命令添加快捷方式字母或单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android Studio的终端"窗口中,我过于频繁地使用一些命令,这非常令人沮丧.

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连接192.168.43.1

虽然Android Studio尚未重新启动,但只要键入一次,就可以使用 up down 箭头键进行选择.

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

但是问题是我每天重启AS或在项目之间切换很多次.一遍又一遍地写这些命令真是太痛苦了.

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

例如,对于命令 adb connect 192.168.43.1 ,我只想输入 c 并按Enter键.对于另一个,我只想输入 k .

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.

我们如何实现?

推荐答案

请按照以下步骤操作:

1)转到 adb.exe 的根文件夹:

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

按住Ctrl + Shift + Esc打开任务管理器,然后在详细信息"选项卡中,右键单击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)在该目录中,创建一个新的文本文档,并将其名称更改为所需的快捷字母,并将扩展名从 txt 更改为 bat .即 k.bat :

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)现在在记事本中打开文件,或右键单击该文件并选择编辑",然后键入命令并保存并关闭它:

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:

您也可以对其他命令执行步骤2和3.即 c.bat ,请注意不要将其命名为类似于已定义的命令.

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.

现在,如果您返回终端,您只需编写 k c 并按Enter键即可.

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

这篇关于如何在Android Studio的终端中为常用命令添加快捷方式字母或单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆