如何在运行时运行命令窗口 [英] how to run command windows at run time

查看:123
本文介绍了如何在运行时运行命令窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个控件,为了在工具箱中添加它,我需要在IDE的设计时在命令窗口中运行命令,以便运行installCommunityControls,就像打开命令窗口一样(查看菜单 - >其他窗口 - >命令窗口)然后键入installCommunityControls,有没有办法在c#中执行此操作?

I have developed a control and in order to add it in toolbox, I need to run a command in a command windows at design time in IDE in order to run installCommunityControls like when you do it by opening command window ( View menu -> other windows -> command window ) and then type installCommunityControls, is there any way to do that in c#?

推荐答案

我在这台PC上只有VisualStudio 2008 ,但也许它可能在某些方面类似于其他版本:



1)为您的外部工具创建新条目(在这种情况下为CMD.exe)。

a)菜单:工具 - >外部工具......

b)按添加按钮创建外部工具条目。

c)给它一个合适的名字(Win Command Console,或者你喜欢的任何一个)。

d)将Command设置为cmd.exe。

e)取消选中使用输出窗口。

f)选择最适合您需求的初始目录。



2)记下工具的外部工具列表中的索引。它基于'1',而不是基于零。



3)打开选项配置对话框(菜单:工具 - >选项...)。



4)转到环境/键盘。



5)在过滤器中(标有文本框) 显示包含以下内容的命令:)键入ExternalCommand。

这将显示引用外部工具的内部宏列表。



6 )选择名为Tools.ExternalCommand的项目,然后选择工具的索引。

例如如果你的工具是外部工具列表中的第三个,那么名称将是

Tools.ExternalCommand3。



7)点击在标有按快捷键的文本框上,然后按所需的快捷键。

如果快捷方式已经分配给任何其他命令,它将在显示的

列表中选择它低于文本框。



它对我有用,希望它适合你。
I only have VisualStudio 2008 on this PC, but perhaps it could be somehow similar on other versions:

1) Create the new entry for your external tool (CMD.exe inthis case).
a) Menu: "Tools->External Tools..."
b) Press the "Add" button to create your external tool entry.
c) Give it the appropiate name (Win Command Console, or whichever you like).
d) Set "Command" to "cmd.exe".
e) Uncheck the "Use Output Window".
f) Select the "Initial Directory" that best suits your needs.

2) Take note of the tool's index in the external tools list. It's '1' based, not zero based.

3) Open the "Options" configuration dialog (Menu: "Tools->Options...").

4) Go to "Environment/Keyboard".

5) In the filter (textbox labeled "Show commands containing:") type "ExternalCommand".
That will show the list of internal macros referencing the external tools.

6) Select the item named "Tools.ExternalCommand" followed by your tool's index.
E.g. if your tool is the third in the external tools list, then the name will be
"Tools.ExternalCommand3".

7) Click on the textbox labeled "Press shortcut keys" and press the shortcut you want.
If the shortcut is already assigned to any other command it will select it in the
list shown bellow the textbox.

It works for me, hope it works for you.


这篇关于如何在运行时运行命令窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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