Batch file 自定义命令提示视图时出现问题

Batch file 自定义命令提示视图时出现问题,batch-file,command-prompt,Batch File,Command Prompt,我对自定义命令提示符有些困惑。 我学习了命令提示符,我希望提示符有如下三行: Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. (directory here) > 我尝试执行此命令,但根本不起作用: Prompt $V &^ prompt $P &^ prompt $G 我想这就是你想要的: prompt $P$_$G 如

我对自定义命令提示符有些困惑。 我学习了命令提示符,我希望提示符有如下三行:

Microsoft Windows [Version 10.0.14393]

(c) 2016 Microsoft Corporation. All rights reserved.

(directory here)

>
我尝试执行此命令,但根本不起作用:

Prompt $V &^

prompt $P &^

prompt $G

我想这就是你想要的:

prompt $P$_$G

如果确实需要Windows版本,请执行以下操作:

prompt $V$_$P$_$G

如果你真的想要和你的问题一样,有版权和额外的换行符,你想要这个:

prompt $V$_$_(c) 2016 Microsoft Corporation. All rights reserved.$_$_$P$_$_$G


根据帮助(
提示符/?
),不支持
$^
。在某些情况下,插入符号通常用于行延续和转义

以下是文件。您将看到,
$P
是路径,
$\u
是回车,
$G
大于。您可以使用这些方法的组合来获得上述3个屏幕截图所示的结果

更改cmd.exe命令提示符。
提示[文本]
text指定新的命令提示。
提示可以由普通字符和以下特殊代码组成:
$A&(与号)
$B |(管道)
$C((左括号)
$D当前日期
$E转义码(ASCII码27)
$F)(右括号)
$G>(大于符号)
$H退格(删除上一个字符)
$L<(小于符号)
$N当前驱动器
$P当前驱动器和路径
$Q=(等号)
$S(空间)
$T当前时间
$V Windows版本号
$\回车和换行符
$$$(美元符号)
如果启用了命令扩展,则提示命令支持
以下附加格式字符:
$+零个或多个加号(+)字符,具体取决于
PUSHD目录堆栈的深度,每个堆栈一个字符
推平。
$M显示与当前驱动器关联的远程名称
字母或空字符串(如果当前驱动器不是网络驱动器)
开车。

您确定这是命令提示符而不是powershell吗?@geisterfurz007 powershell输出将在顶部显示powershell,而不是windows版本。您希望提示符的外观如何?@Breadgrammer:我编辑了您的问题,以使其更具可读性。我还删除了关于启动命令提示符时自动运行命令的第二个问题。请把这当作一个新问题来问。@Scott谢谢!我只是想知道$,因为我只是从powershell知道的。我想他想要的是
prompt$V$\u$P$\u$G
,我假设这个版本是他打开一个新的命令提示符,但这确实让他的“三行”评论更有意义。我将更新我的答案。
$V
不包含版权信息,因此它是通过打开命令提示符获得的。不过还是更新了一些选项。Prompt也接受常规字符串,所以可以想象,您可以手动键入该位。哈哈,我想这是真的,但是。。。更新为包括它的乐趣!
Changes the cmd.exe command prompt.

PROMPT [text]

  text    Specifies a new command prompt.

Prompt can be made up of normal characters and the following special codes:

  $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 version number
  $_   Carriage return and linefeed
  $$   $ (dollar sign)

If Command Extensions are enabled the PROMPT command supports
the following additional formatting characters:

  $+   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.