强大的Cmder

why

  1. 漂亮,包装并美化了各个shell
  2. 带task功能,能记忆,能执行脚本
  3. 配合win10的bash,能实现相似xshell的功能

注意点

须要注意的一点,Cmder来源于另一个项目ConEmu,所以不少的设置介绍都在这个项目下面。好比说task设置的语法html

Task设置介绍

简介

在settings->Startup下面。添加一个task后,能够设置名称,名称按group分类。git

好比我设置两个任务,bash::pi,bash::test。github

在显示task时,这两个会放在一个task group里面(名字为bash),这个group里面有两个任务,一个叫pi,一个叫test。shell

Task parameters

这里通常就是设置iconbash

  1. /icon 能够设置icon
  2. /dir 设置启动目录

Commands

  1. 第一个参数为要启动的app,后面为要带的参数,好比
PowerShell -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''" -new_console:d:"%USERPROFILE%"

app为powershell,参数为-ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command "Invoke-Expression '. ''%ConEmuDir%\..\profile.ps1'''"app

  1. -new_console - cur_console为cmder的指令(实际是ConEmu的),用来指定窗口的特征。能够指定目录,layout,等等详细参考ConEmu的介绍。
-new_console[:switches]
   or
-cur_console[:switches]
   a - RunAs shell verb (as Admin on Vista+, user/pwd in Win2k and WinXP)
   b - create background tab
   c[0] - force enable [silent] ‘Press Enter or Esc to close console’
   C:"<iconfile>" - specify icon used in tab
   d:"<dir>" - specify working directory
   f - force starting console active, useful when starting several consoles simultaneously
   h<height> - i.e., h0 - turn buffer off, h9999 - switch to 9999 lines
   i - don't inject ConEmuHk into starting process
   I - (GuiMacro only) forces inheriting of root process contents, like ‘Duplicate root’ feature
   m:/mnt - defines ‘/mnt’ prefix for Unix-path conversion
   n - disable ‘Press Enter or Esc to close console’
   o - don't enable ‘Long console output’ when starting command from Far Manager
   p[N] - pty modes, N - bitmask: 1 - XTermKeys, 2 - BrPaste, 4 - AppCursorKeys; default is 5 (1+4)
   P:"<palettename>" - set fixed palette for tab
   r - run as restricted user
   R - force start hooks server in the parent process
   s[<SplitTab>T][<Percents>](H|V) - run new console in a split
   t:"<tabname>" - rename new created tab
   u - ConEmu choose user dialog
   u:"<user>:<pwd>" - specify user/pwd in args
   w - Enable ‘Overwrite’ mode in command prompt by default
   W:"<tabwallpaper>" - use specified wallpaper for the tab
   z - Don't use ‘Default terminal‘ feature for this command

最经常使用的就是生成新窗口,好比ssh

在当前窗口下面生成一个新的cmd窗口ui

cmd -new_console:sV

在当前窗口右边生成一个新的cmd窗口this

cmd -new_console:sH

如何设置bash启动ssh

使用xshell时,最方便的是记忆ssh地址,一键ssh。这里使用cmder加bash完成。rest

基本设置

bash -new_console:i /mnt/e/pi/pi.sh

这条指令以后,便可执行pi.sh,这个sh里面只是简单的配置ssh。

指定layout

bash -new_console:sVi /mnt/e/pi/pi.sh

指定工做目录(无用)

bash -new_console:sVi:d /mnt/e/pi/pi.sh E:/pi

目前上述方法还有bug。若是采用上述方式ssh,会致使cmder没法记忆以前的命令,也就没法用上下方向键翻历史记录。

替代方案

bash -new_console:sHh999d:E:\pi
  • sH : 指定新窗口在右边
  • h999 : buffer大小999,便可以记忆这么多条指令
  • d:E:\pi : 指定工做目录在E:\pi下面。这里须要注意d:E:\pi是连着的,不能有空格

这样就是开启了bash,并设置工做目录到想要的目录下面,而后ssh的话直接调用脚本便可。

相关文章
相关标签/搜索