標題:

DOS Command

發問:

I want to echo a date in YYMMDD format I got the following command but the result is YYYYMMDD format: For /F "tokens=2-4 delims=/ " %i in ('date /t') do echo %k%i%j Could any professionals help????!

免費註冊體驗

 

此文章來自奇摩知識+如有不便請留言告知

最佳解答:

i had answered similar question in: http://hk.knowledge.yahoo.com/question/?qid=7007050606229 try to use system variable %DATE% to get the current date. if u want to output date in format YYMMDD, u need to know the default date format. if the date format is dd/mm/yyyy day ( for example: 26/10/2007 Fri ), try this echo %date:~8,2%%date:~3,2%%date:~0,2% if the date format is yyyy/mm/dd day ( for example: 2007/10/26 Fri ), try this echo %date:~2,2%%date:~5,2%%date:~8,2% OK?

其他解答:

try this: for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j echo %yyyymmdd%
arrow
arrow
    全站熱搜

    omckyyo 發表在 痞客邦 留言(0) 人氣()