在 cmd.exe 中输入 %^ 是 Windows 的复活节彩蛋吗?

在 cmd.exe 中输入 %^ 是 Windows 的复活节彩蛋吗?

当我输入%^cmd 并按下时Enter,它显示:

More?

当我Enter再次按下时,它给出了相同的回应。

这是复活节彩蛋吗?这是什么?

答案1

CMD 是基于行的。它每次只读取并执行一行。当您输入内容但尚未完成一行时,它会提示More?

您的具体情况是没有线路结束,因此正在等待查看%标志后面的内容。

使用括号更容易看

尝试dir

然后

(dir
echo %time%
(type c:\windows\win.ini
)
)

只有当行完整(匹配括号)时才会读取并执行。

这是标点符号列表。

&    separates commands on a line.

&&    executes this command only if previous command's errorlevel is 0.

||    (not used above) executes this command only if previous command's errorlevel is NOT 0

>    output to a file

>>    append output to a file

<    input from a file

|    output of one command into the input of another command

^    escapes any of the above, including itself, if needed to be passed to a program

"    parameters with spaces must be enclosed in quotes

+ used with copy to concatenate files. E.G. copy file1+file2 newfile

, used with copy to indicate missing parameters. This updates the files modified date. E.G. copy /b file1,,

%variablename% a inbuilt or user set environmental variable

!variablename! a user set environmental variable expanded at execution time, turned with SelLocal EnableDelayedExpansion command

%<number> (%1) the nth command line parameter passed to a batch file. %0 is the batch file's name.

%* (%*) the entire command line.

%<a letter> or %%<a letter> (%A or %%A) the variable in a for loop. Single % sign at command prompt and double % sign in a batch file.

\\ (\\servername\sharename\folder\file.ext) access files and folders via UNC naming.

: (win.ini:streamname) accesses an alternative steam. Also separates drive from rest of path.

. (win.ini) the LAST dot in a file path separates the name from extension

. (dir .\*.txt) the current directory

.. (cd ..) the parent directory


\\?\ (\\?\c:\windows\win.ini) When a file path is prefixed with \\?\ filename checks are turned off. 

< > : " / \ | Reserved characters. May not be used in filenames.



Reserved names. These refer to devices eg, 

copy con <filename> 

which copies a file to the console window.

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, 

COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, 

LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9



Maximum path length              260 characters
Maximum path length (\\?\)      32,767 characters (approx - some rare characters use 2 characters of storage)
Maximum filename length        255 characters


.
--

答案2

不。

作为可信计算计划的一部分,微软于 2002 年正式停止在其程序中加入复活节彩蛋。
https://en.wikipedia.org/wiki/Easter_eggs_in_Microsoft_products

微软的拉里·奥斯特曼 (Larry Osterman) 在 2005 年 10 月指出,添加复活节彩蛋是终止的理由。

如今,在微软操作系统中添加一个彩蛋就会立即导致终止,所以你不太可能再看到另一个了。
https://blogs.msdn.com/b/larryosterman/archive/2005/10/20/483110.aspx
或者:MSDN 博客存档

命令提示符正在寻找More?命令的延续(),因为它以转义字符结尾^

可以使用 ^ 转义字符将长命令拆分为多行并转义回车符,从而使长命令更具可读性

答案3

真的很简单,从所有其他的答案和评论(以及我自己的一些意见)中我收集到了以下内容:

  • 微软并没有添加复活节彩蛋,而这个也不是。
  • 即使打字也会^得到相同的响应。
  • ^用于完成未完成的命令:[感谢@n00b]

    C:\windows\system32>net ^
    More? user
    
    User accounts for \\INFINITEPC
    
    -------------------------------------------------------------------------------
    Administrator            Guest                    Rahul
    The command completed successfully.
    

  • 因此基本上如果你输入ip^并按下回车键然后输入config那么 cmd 会将其注册为ipconfig
  • ^用于使长命令更具可读性。[感谢@Steven]
  • 我以为这是一个彩蛋,因为我没想到 cmd 会用人类语言做出回应

  • 相关内容