简体   繁体   English

有没有更好的 Windows 命令提示?

[英]Are there any better command prompts for Windows?

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.出于某种原因,Windows 命令提示符是“特殊的”,因为您必须转到属性对话框来水平调整其大小,而不是像其他所有应用程序一样拖动窗口的一角。 Unsurprisingly this feature made it into PPP-Powershell as well -- is there any way around this via command prompt replacement or Windows hackery?不出所料,这个功能也进入了 PPP-Powershell —— 有没有办法通过命令提示符替换或 Windows 黑客来解决这个问题?

2019 Update: 2019 更新:

  • Microsoft has released the terminal app on Github & the Windows Store , and it has tabs, panels, acrylic transparency, and other features.微软已经在GithubWindows Store上发布了终端应用程序,它具有选项卡、面板、亚克力透明度和其他功能。

2016 Update: 2016年更新:

  • Windows 10's default conhost UI has more features, including free resize, transparency, etc (this includes cmd & powershell) Windows 10 的默认主机 UI 具有更多功能,包括自由调整大小、透明度等(包括 cmd 和 powershell)
  • I now use ConEmu (walkthrough here ) which has many features including tabs & split panes.我现在使用ConEmu此处的演练),它具有许多功能,包括选项卡和拆分窗格。
  • Other options include Cmder (which comes with additional tools built in), and ConsoleZ (a fork of Console2).其他选项包括Cmder (附带内置附加工具)和ConsoleZConsole2 的一个分支)。
  • Console appears to no longer be updated控制台似乎不再更新

I don't know if this is what you want: Resizing the Powershell Console Window.我不知道这是否是您想要的:调整 Powershell 控制台窗口的大小。 If so, I got this awhile ago: Just type: resize and use the arrow keys to adjust width and height.如果是这样,我不久前得到了这个:只需键入:调整大小并使用箭头键来调整宽度和高度。

##
## 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
        }
    }
  }
}

If you don't mind installing cygwin you can use it with xterm or rxvt.如果您不介意安装 cygwin,您可以将它与 xterm 或 rxvt 一起使用。 You'll also be able to use Bash as the shell instead of cmd.exe which is much nicer.您还可以使用 Bash 作为外壳,而不是使用更好的 cmd.exe。

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.这不是您想要的,但我解决它的方法是使用 cygwin 的无根 X-Windows 模式和 XTerms。 I prefer the unix command line environment more then Windows' env, and the XTerm windows act just like any other window.我更喜欢 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.我还没有尝试过,所以我不确定它们是否有你要找的东西,但它们可能值得一试。

Way after the fact, but things have improved in the meantime.事后如此,但在此期间情况有所改善。 ConEmu is highly configurable, and can be resized horizontally and vertically. ConEmu是高度可配置的,可以水平和垂直调整大小。 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. Scott Hanselman 写了关于它的文章,包括与 FarManager 的集成。

PowerShell v2.0 ships with an interactive shell, called the PowerShell Integrated Script Environment (ISE). PowerShell v2.0 附带一个交互式 shell,称为 PowerShell 集成脚本环境 (ISE)。 It's not fantastic, but it's usually better than the console subsystem.它并不出色,但通常比控制台子系统更好。

Good好的

  • Includes a PowerShell script editor, with colorization包括一个 PowerShell 脚本编辑器,带有颜色

  • Colorization as a type at the prompt提示时将着色作为一种类型

  • I can have multiple PowerShell sessions, including remote sessions, as tabs.我可以将多个 PowerShell 会话(包括远程会话)作为选项卡。

  • The ISE is PowerShell-aware, so I can manipulate and extend it with PowerShell. ISE 支持 PowerShell,因此我可以使用 PowerShell 对其进行操作和扩展。 For example, see the "IsePack", which adds a ton of features, including copy-as-HTML.例如,请参阅“IsePack”,它添加了大量功能,包括 copy-as-HTML。

  • Can easily scale the text可以轻松缩放文本

  • Conventional Windows resizing, cursor navigation, selection, copy, paste, fonts, etc.常规的 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.检测其标准 IO 是否被重定向的控制台应用程序会认为是这样,因此行为很奇怪。 The worst is TFS's tf.exe.最糟糕的是 TFS 的 tf.exe。 For example, 'tf submit' will submit without prompting, even though the prompt is GUI, not CLI.例如,'tf submit' 将在没有提示的情况下提交,即使提示是 GUI,而不是 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.很明显,他们想制作一个更丰富的 PowerShell IDE,但没有。

You might consider installing FAR .您可能会考虑安装FAR It's an excellent text mode file manager and much more.它是一个出色的文本模式文件管理器等等。 It could also be resized by dragging the corner of the window :)它也可以通过拖动窗口的角来调整大小:)

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 的字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM