当我输入%^
cmd 并按下 时Enter,它说:
More?
Run Code Online (Sandbox Code Playgroud)
当我Enter再次按下时,它给出了相同的响应。
这是复活节彩蛋吗?这是什么?
Ste*_*ven 113
不。
微软于 2002 年正式停止在其程序中包含复活节彩蛋,作为其可信计算计划的一部分。http:
//en.wikipedia.org/wiki/Easter_eggs_in_Microsoft_products
微软的 Larry Osterman 在 2005 年 10 月指出,添加一个复活节彩蛋是终止的理由。
如今,向 Microsoft 操作系统添加一个复活节彩蛋是立即终止的理由,因此您极不可能再看到另一个。
http://blogs.msdn.com/b/larryosterman/archive/2005/10/20/483110.aspx
命令提示符正在寻找命令的延续 ( More?
),因为它以转义字符 结束^
。
^ 转义字符可用于使长命令更具可读性,方法是将它们拆分为多行并在行尾转义回车符 + 换行符 (CR/LF)
http://ss64.com/nt/syntax- esc.html
tri*_*ger 51
CMD 是基于行的。它一次只读取和执行一行。当您输入并且您还没有完成一行时,它会提示More?
.
你的具体事情是没有行结束,所以它在等着看%
标志后面会发生什么。
使用括号更容易查看
尝试 dir
然后
(dir
echo %time%
(type c:\windows\win.ini
)
)
Run Code Online (Sandbox Code Playgroud)
只有当该行完成(匹配括号)时才会读取和执行。
这是标点符号列表。
& 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
.
--
Run Code Online (Sandbox Code Playgroud)
真的很简单,从所有其他答案和评论(以及我自己的一些输入)中,这是我收集到的:
^
给出相同的响应。
^
用于完成不完整的命令:[感谢@n00b]
C:\windows\system32>net ^
More? user
User accounts for \\INFINITEPC
-------------------------------------------------------------------------------
Administrator Guest Rahul
The command completed successfully.
Run Code Online (Sandbox Code Playgroud)
ip^
并按回车然后输入config
然后 cmd 将它注册为ipconfig
.
^
用于使长命令更具可读性。[感谢@Steven]