编写我自己的自定义命令行“包装器” 用于窗户
我从来都不喜欢 Windows 命令行。 我尝试过像 powercmd 这样的工具并且喜欢它们,但大多数都不是免费分发的,而且我不喜欢为我认为可以自己编写的东西付费的想法。 我想编写自己的类似于 powercmd 的命令行包装器,它允许以下属性:
- 自定义字体和颜色
- 窗口的不透明度
- 在面板中同时打开多个窗口(可能像选项卡式浏览)
- 能够调整窗口大小
我正在与您联系现在,请大家帮助我决定是否应该在 Visual Studio 中使用 C# 尝试此操作,或者是否应该使用 Swing 在 Java 中进行此操作。 我对两者都很满意。 有没有人做过这样的命令行包装器? 如果是的话,您使用什么语言?您的经历是什么? 感谢您的任何反馈。
授予-
I have never been a fan of the windows command line. I have tried tools like powercmd and liked them, but most are not distributed for free and I don't relish the thought of paying for something that I think I could write myself. I want to write my own command line wrapper similar to powercmd that allows for these properties:
- Custom fonts and colors
- Opacity of windows
- Multiple windows opened at same time in a panel (maybe like tabbed browsing)
- Ability to resize windows
I am reaching out to you guys now to help me decide on whether I should attempt this with C# in visual studio or whether I should do it in Java with Swing. I am comfortable with both. Has anyone ever done a command line wrapper like this? If so what language did you use and what was your experience? Thanks for any feedback.
Grant-
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果你想做 Windows 命令行,我会推荐 C#。 Java 强制的平台独立性将使您难以将命令传递给底层操作系统。
If you want to do a windows command line, I would recommend C#. Java's enforced platform independence will make you fight too much to pass along commands to the underlying OS.
Console2 已经达到了要点 - 可调整大小、不透明度、制表符、可修改字体。
它是用 C++ 编写的,在底层它包装了 cmd.exe(或您告诉它使用的任何命令 shell),因此如果您真的有兴趣用托管语言开发自己的 shell,那么这可能是对它的两次打击。
There's already Console2 that hits the big bullet points - resizable, opacity, tabs, modifiable fonts.
It's written in C++ and under the hood it wraps cmd.exe (or whichever command shell you tell it to use) so those may be two strikes against it if you're really interested in developing your own shell in a managed language.
既然你问了,我自己用 C# 编写了一个 - Process 类太有用了。 这里最主要的是 I/O 重定向。 虽然我自己从未完全管理过它,但您需要这样做,以便子进程输出不会出现在另一个控制台窗口中。 您还可以终止程序、查找现有程序等。
此外,C# 的控制台操作也非常方便。
虽然我不是 Java 程序员,但我可以想象,考虑到 Java 是平台无关的,这两个重要功能都很难使用。
Since you asked, I wrote one myself in C# - the
Process
class is just too useful. The main thing here is I/O redirection. While I never managed it fully myself, you need this so that subprocess output doesn't appear in another console window. You can also kill programs, find existing ones, etc.Also, C#'s Console manipulation is very handy.
While I am not a Java programmer, I can imagine that both of those important features would be quite hard to use, considering that Java is platform-independent.
对于此类项目,C# 比 Java 有几个优点,其中最重要的是与 Windows 更好的集成,Windows(大概)是您为其开发此项目的唯一平台。 Java Swing 库在 Windows 机器上的外观并不像 C# 表单那样经过微调,而且由于能够使用 WPF,C# 对我来说似乎是明显的赢家。
C# has several benefits over Java for this type of project, not the least of which is better integration with Windows, which is (presumably) the only platform you're developing this for. The Java Swing library is not nearly as fine-tuned looking on windows machines as C# forms tend to be, and with the ability to use WPF, C# seems the clear winner to me.
我不会为此使用 Java 和 Swing。 C# 将让您直接与 .Net 框架进行通信,并让您能够构建更强大的命令行工具。 让 Java 访问某些 Windows 系统调用将是一件麻烦事。
I would not use Java and Swing for this. C# will let you communicate directly with the .Net framework and allow you the ability to build a more powerful command line tool. IT will be a hassle to get Java access to some Windows System calls.
只是想让大家知道我最终确实用 C# 编写了一个命令行包装器。 结果真的很好。 我还有一些小东西想要添加,然后我将提供源代码以及下载 .exe 的位置。 我发布了一个实际操作的视频,以防有人想要提供反馈或想法。 谢谢您的帮助。
http://www.youtube.com/watch?v=-NM-XcYwLDc< /a>
Just wanted to let you all know that I did end up writing a command line wrapper with C#. It turned out really well. I have a couple more little things I want to add and then I will put up the source code as well as a place to download the .exe. I posted a video of it in action in case anyone wanted to provide feedback or ideas. Thanks for the help.
http://www.youtube.com/watch?v=-NM-XcYwLDc