问题描述
我发现了这个程序 web.archive.org:http://baiyunmanor.com/blog/work/get-current-date-time-in-dos-batch-file/
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This uses Windows Scripting Host to set variables
:: to the current date/time/day/day_number
:: for Win9x/ME/NT/W2K/XP etc
:: Thanks go to Todd Vargo for his scripting
::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
set TmpFile="%temp%. mp.vbs"
echo> %TmpFile% n=Now
echo>>%TmpFile% With WScript
echo>>%TmpFile% .Echo "set year=" + CStr(Year(n))
echo>>%TmpFile% .Echo "set yr=" + Right(Year(n),2)
...
cscript //nologo "%temp%. mp.vbs" > "%temp%. mp.bat"
call "%temp%. mp.bat"
...
echo date F [ddmmyy] [%day%%month%%yr%]
:: datetime.bat
但我不知道线路是什么
:: datetime.bat
最后是什么意思?
推荐答案
::
是一个标签(不准确的也称为评论标签)可以,在实践中,就像 REM
一样被视为注释,因为它是不可跳转"的标签.
::
is a label (inaccurately also known as comment label) can be, in practice, considered a comment just as REM
is, because it is an "un-goto-able" label.
不过,REM
和 ::
之间存在一些区别.主要有:
There are some differences between REM
and ::
, though. The main ones are:
使用
ECHO ON
会显示REM
行,但没有用::
With
ECHO ON
aREM
line is shown but not a line commented with::
一个 ::
可以执行一个行尾插入符(即在以 ::
开头的行尾的一个 ^
code> 使下一行也成为注释):
A ::
can execute a line end caret (that is, a ^
at the end of a line starting with ::
makes the next line also a comment):
:: This is a comment^
echo but watch out because this line is a comment too
标签和 ::
具有特殊的逻辑,可能会导致括号块出现问题 - 在 (
)
.示例:
Labels and ::
have a special logic and can cause problems in parentheses blocks - take care when using them inside (
)
. Example:
for %%D in (hi) do (
echo Before...
:: My comment
:: Some other comment
echo After...
)
输出:
Before ...
The system cannot find the drive specified.
After...
这篇关于::(双冒号)在 DOS 批处理文件中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!