有没有更好的 Windows 命令提示?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/153983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Are there any better command prompts for Windows?
提问by Luke
For some reason the Windows command prompt is "special" in that you have to go to a properties dialog to resize it horizontally rather than just dragging the corner of the window like every other app. Unsurprisingly this feature made it into P-P-P-Powershell as well -- is there any way around this via command prompt replacement or Windows hackery?
出于某种原因,Windows 命令提示符是“特殊的”,因为您必须转到属性对话框来水平调整其大小,而不是像其他所有应用程序一样拖动窗口的一角。不出所料,这个功能也进入了 PPP-Powershell——有没有办法通过命令提示符替换或 Windows 黑客来解决这个问题?
采纳答案by Factor Mystic
2019 Update:
2019 更新:
- Microsoft has released the terminal app on Github& the Windows Store, and it has tabs, panels, acrylic transparency, and other features.
- 微软已经在Github和Windows Store上发布了终端应用程序,它具有选项卡、面板、亚克力透明度和其他功能。
2016 Update:
2016年更新:
- Windows 10's default conhost UI has more features, including free resize, transparency, etc (this includes cmd & powershell)
- I now use ConEmu(walkthrough here) which has many features including tabs & split panes.
- Other options include Cmder(which comes with additional tools built in), and ConsoleZ(a fork of Console2).
- Consoleappears to no longer be updated
回答by avgbody
I don't know if this is what you want: Resizing the Powershell Console Window. If so, I got this awhile ago: Just type: resizeand use the arrow keys to adjust width and height.
我不知道这是否是您想要的:调整 Powershell 控制台窗口的大小。如果是这样,我不久前得到了这个:只需键入:调整大小并使用箭头键来调整宽度和高度。
##
## Author : Roman Kuzmin
## Synopsis : Resize console window/buffer using arrow keys
##
function Size($w, $h)
{
New-Object System.Management.Automation.Host.Size($w, $h)
}
function resize()
{
Write-Host '[Arrows] resize [Esc] exit ...'
$ErrorActionPreference = 'SilentlyContinue'
for($ui = $Host.UI.RawUI;;) {
$b = $ui.BufferSize
$w = $ui.WindowSize
switch($ui.ReadKey(6).VirtualKeyCode) {
37 {
$w = Size ($w.width - 1) $w.height
$ui.WindowSize = $w
$ui.BufferSize = Size $w.width $b.height
break
}
39 {
$w = Size ($w.width + 1) $w.height
$ui.BufferSize = Size $w.width $b.height
$ui.WindowSize = $w
break
}
38 {
$ui.WindowSize = Size $w.width ($w.height - 1)
break
}
40 {
$w = Size $w.width ($w.height + 1)
if ($w.height -gt $b.height) {
$ui.BufferSize = Size $b.width $w.height
}
$ui.WindowSize = $w
break
}
27 {
return
}
}
}
}
回答by manicmethod
If you don't mind installing cygwin you can use it with xterm or rxvt. You'll also be able to use Bash as the shell instead of cmd.exe which is much nicer.
如果您不介意安装 cygwin,您可以将它与 xterm 或 rxvt 一起使用。您还可以使用 Bash 作为外壳,而不是使用更好的 cmd.exe。
回答by Herms
This isn't quite what you're looking for, but the way I get around it is by using cygwin's rootless X-Windows mode and XTerms. I prefer the unix command line environment more then Windows' env, and the XTerm windows act just like any other window.
这不是您要找的东西,但我绕过它的方法是使用 cygwin 的无根 X-Windows 模式和 XTerms。我更喜欢 unix 命令行环境而不是 Windows 的 env,XTerm 窗口就像任何其他窗口一样。
As for straight replacements, a quick google search shows these:
至于直接替换,快速谷歌搜索显示这些:
I haven't tried them, so I'm not sure if they have what you're looking for, but they might be worth a shot.
我没有尝试过它们,所以我不确定它们是否有你要找的东西,但它们可能值得一试。
回答by Jay Bazuzi
PowerShell v2.0 ships with an interactive shell, called the PowerShell Integrated Script Environment (ISE). It's not fantastic, but it's usually better than the console subsystem.
PowerShell v2.0 附带一个交互式 shell,称为 PowerShell 集成脚本环境 (ISE)。它并不出色,但通常比控制台子系统更好。
Good
好的
Includes a PowerShell script editor, with colorization
Colorization as a type at the prompt
I can have multiple PowerShell sessions, including remote sessions, as tabs.
The ISE is PowerShell-aware, so I can manipulate and extend it with PowerShell. For example, see the "IsePack", which adds a ton of features, including copy-as-HTML.
Can easily scale the text
Conventional Windows resizing, cursor navigation, selection, copy, paste, fonts, etc.
包括一个 PowerShell 脚本编辑器,带有着色
在提示下将着色作为一种类型
我可以将多个 PowerShell 会话(包括远程会话)作为选项卡。
ISE 支持 PowerShell,因此我可以使用 PowerShell 对其进行操作和扩展。例如,请参阅“IsePack”,它添加了大量功能,包括 copy-as-HTML。
可以轻松缩放文本
常规的 Windows 调整大小、光标导航、选择、复制、粘贴、字体等。
Bad
坏的
Interactive console applications block waiting for input, and thus hang.
Console applications that detect whether their standard IO are redirected will think that is so, and thus act oddly. The worst is TFS's tf.exe. For example, 'tf submit' will submit without prompting, even though the prompt is GUI, not CLI.
A limited feature set out of the box. It's obvious they would like to make a much richer PowerShell IDE but did not.
交互式控制台应用程序阻止等待输入,从而挂起。
检测其标准 IO 是否被重定向的控制台应用程序会认为是这样,因此行为很奇怪。最糟糕的是 TFS 的 tf.exe。例如,'tf submit' 将在没有提示的情况下提交,即使提示是 GUI,而不是 CLI。
开箱即用的有限功能。很明显,他们想制作一个更丰富的 PowerShell IDE,但没有。
回答by Tim Condit
Way after the fact, but things have improved in the meantime. ConEmuis highly configurable, and can be resized horizontally and vertically. It has the somewhat odd (to me anyway) behavior of resizing the font as the window is resized. There's some discussion about it here. And Scott Hanselman has written about it, including integration with FarManager.
事后如此,但在此期间情况有所改善。ConEmu是高度可配置的,可以水平和垂直调整大小。它有一些奇怪的(对我来说)在调整窗口大小时调整字体大小的行为。有一些关于它的讨论在这里。Scott Hanselman写了关于它的文章,包括与 FarManager 的集成。
回答by Richard A
If you set the property 'Layout/Screen Buffer Size/Width' then, when prompted, choose 'Modify shortcut that started this window' it will remember the buffer width. Then when you start another command prompt it will be, for example, the original 80 wide, but you can now stretch it to whatever you set the buffer width to.
如果您设置“布局/屏幕缓冲区大小/宽度”属性,则在出现提示时,选择“修改启动此窗口的快捷方式”,它将记住缓冲区宽度。然后,当您启动另一个命令提示符时,它将是原来的 80 宽,但您现在可以将其拉伸到您将缓冲区宽度设置为的任何值。
Command Prompt will not wrap at the current window width, only at the buffer width. Thus if you've set the buffer width to 120, but the window is only 80 wide the lines will wrap at 120 and you'll have to scroll to read characters past 80.
命令提示符不会在当前窗口宽度处换行,只会在缓冲区宽度处换行。因此,如果您将缓冲区宽度设置为 120,但窗口只有 80 宽,则行将在 120 处换行,您必须滚动以读取超过 80 的字符。