cmd prompt_CMD.EXE或酷提示环境变量的一个更好的PROMPT和一个很好的透明多提示

cmd prompt

cmd prompt

A number a people have commented on my simple, but customized command prompt. Actually I have a few, but for cmd.exe, I do this. Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to $p$_$+$g. This came originally from Craig Andera, who got it from Shawn Van Ness. Sahil Malik also has some great command line tricks. Junfeng points out the little known ntcmds.chm.

许多人在我的简单但自定义的命令提示符中发表了评论。 其实我有几个,但是对于cmd.exe,我可以这样做。 右键单击“我的电脑” |“属性”。 然后从“高级”选项卡中,单击“环境变量”,然后添加一个名为PROMPT的新用户变量,并将其设置为$ p $ _ $ + $ g 。 这最初是来自克雷格•安德拉( Craig Andera)的,他是肖恩•范•内斯( Shawn Van Ness)买到的萨希尔·马利克(Sahil Malik)也有一些很棒的命令行技巧俊峰指出了鲜为人知的ntcmds.chm

A screenshot of the System Properties Dialogs

Here's the breakdown:

细目如下:

  • $P = Current Directory's Path

    $ P =当前目录的路径
  • $_ = Carriage Return

    $ _ =回车
  • $+ = A plus sign for each level in the PUSHD/POPD stack.

    $ + = PUSHD / POPD堆栈中每个级别的加号。

Here's some other interesting prompts. Paste these into any CMD.EXE window:

这是其他一些有趣的提示。 将它们粘贴到任何CMD.EXE窗口中:

set prompt=[%computername%] $d$s$t$_$p$_$_$+$g

设置提示= [%计算机名%] $ d $ s $ t $ _ $ p $ _ $ _ $ + $ g

yields this. Note the use of an environment variables within a prompt. Here's an extensive list of environment variables.

产生这个。 注意在提示中使用环境变量。 这是环境变量详尽列表

[SCOTTPC] Thu 07/13/2006 22:19:20.40
C:\Documents and Settings\Scott

[SCOTTPC] 2006年7月13日,星期四22:19:20.40 C:\ Documents and Settings \ Scott

Another nice one:

另一个不错的:

set=prompt=$m$_$p$g

set =提示= $ m $ _ $ p $ g

yields this when on a UNC Mapped Drive:

在UNC映射的驱动器上产生此:

\\FREDPC\C$
Z:\Documents and Settings\Fred

\\ FREDPC \ C $ Z:\ Documents and Settings \ Fred

There's all sorts of crap that PROMPT /? gives you:

PROMPT有各种各样的废话吗? 给你:

  $A   & (Ampersand)
  $B   | (pipe)
  $C   ( (Left parenthesis)
  $D   Current date
  $E   Escape code (ASCII code 27)
  $F   ) (Right parenthesis)
  $G   > (greater-than sign)
  $H   Backspace (erases previous character)
  $L   < (less-than sign)
  $N   Current drive
  $P   Current drive and path
  $Q   = (equal sign)
  $S     (space)
  $T   Current time
  $V   Windows XP version number
  $_   Carriage return and linefeed
  $$   $ (dollar sign)
  $+   zero or more plus sign (+) characters depending upon the
       depth of the PUSHD directory stack, one character for each
       level pushed.
  $M   Displays the remote name associated with the current drive
       letter or the empty string if current drive is not a network
       drive.

$ A&(&) $ B | (管) $ C((左括号) $ D当前日期$ E转义码(ASCII码27) $ F)(右括号) $ G>(大于号) $ H退格键(擦除前一个字符) $ L <(小于号) $ N当前驱动器$ P当前驱动器和路径$ Q =(等号) $ S(空格) $ T当前时间$ V Windows XP版本号$ _回车和换行$$ $(美元符号) $ +零个或多个加号(+)字符,具体取决于PUSHD目录堆栈的深度,每个对应一个字符水平推。 $ M显示与当前驱动器关联的远程名称字母或空字符串(如果当前驱动器不是网络) 驾驶。

Here's my command prompt. It's transparent because I use the awesome Console 2.00 Beta, build 122 hosted at SourceForge. I blogged about this last November.

这是我的命令提示符。 这是透明的,因为我使用了SourceForge上的出色的Console 2.00 Beta,build 122去年11月,写了关于此的博客

Note the multiple tabs. I've got PowerShell, CMD.EXE and two VisualStudio Windows, each in their own tab. I could add a tab for Cygwin, but really, with PowerShell, who needs ls -alogF?

请注意多个选项卡。 我有PowerShell,CMD.EXE和两个VisualStudio Windows,每个都在各自的选项卡中。 我可以为Cygwin添加一个选项卡,但是实际上,使用PowerShell,谁需要ls -alogF

Scottconsole1

Console uses a XML settings file (console.xml) that takes a while to understand. Here's a snippet of my settings. I used short filenames in the VS.NET stuff for simplicity and avoidance of quoted quotes. Remember, DIR /X will give you short filenames for things like this.

控制台使用XML设置文件(console.xml),该文件需要一段时间才能理解。 这是我的设置的摘要。 为了简化和避免引用引号,我在VS.NET中使用了短文件名。 记住,DIR / X将为您提供诸如此类的简短文件名。

...Snip...this is a PARTIAL snippet for illustrative purposes...

...片段...这是用于说明目的的部分片段...

<tabs>
  <tab title="Console">
   <console shell="" init_dir=""/>
  </tab>
  <tab title="PowerShell">
   <console shell="c:\program files\windows powershell\v1.0\powershell.exe" init_dir=""/>
  </tab>
  <tab title="VS.NET 2003">
   <console shell="cmd /k C:\PROGRA~1\MICROS~2.NET\Common7\Tools\vsvars32.bat" init_dir=""/>
  </tab>
  <tab title="VS.NET 2005">
   <console shell="cmd /k C:\PROGRA~1\MID05A~1\VC\vcvarsall.bat" init_dir=""/>
  </tab>
 </tabs>

<标签> <tab title =“ Console”> <console shell =“” init_dir =“” /> </ tab> <tab title =“ PowerShell”> <console shell =“ c:\ program files \ windows powershell \ v1.0 \ powershell.exe” init_dir =“” /> </ tab> <tab title =“ VS.NET 2003”> <console shell =“ cmd / k C:\ PROGRA〜1 \ MICROS〜2.NET \ Common7 \ Tools \ vsvars32.bat” init_dir =“” /> </ tab> <tab title =“ VS.NET 2005”> <console shell =“ cmd / k C:\ PROGRA〜1 \ MID05A〜1 \ VC \ vcvarsall.bat” init_dir =“” /> </ tab> </ tabs>

My font is Consolas, Size 15, Kermit Green (0x00FF00). Enjoy.

我的字体是Consolas,大小15,绿色(0x00FF00)。 请享用。

翻译自: https://www.hanselman.com/blog/a-better-prompt-for-cmdexe-or-cool-prompt-environment-variables-and-a-nice-transparent-multiprompt

cmd prompt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值