- 论坛徽章:
- 0
|
原帖由 liu6545 于 2007-4-24 14:23 发表
- system qq(for /f "tokens=1 delims= " %a in ('date /t') do @echo %a>date.txt);
复制代码
Hi,
using single q( ... ) instead of qq( ... ) to avoid interpret %, @
or using \ to escape %,@
DOS:
C:\>for /f "tokens=1 delims= " %a in ('date /t') do @echo %a
2007-04-24
One Perl-Line:
C:\>perl -le "system qq(for /f \"tokens=1 delims= \" \%a in ('date /t') do \@echo \%a)";
2007-04-24
C:\>perl -le "system q(for /f \"tokens=1 delims= \" %a in ('date /t') do @echo %a)";
2007-04-24
Pure Perl:
C:\>perl -e "($d,$m,$y)=(localtime)[3..5];printf'%04d-%02d-%02d',$y+1900,$m+1,$d"
2007-04-24
-- ulmer |
|