How to get a UNIVERSAL Windows batch file timestamp

前端 未结 5 1675
独厮守ぢ
独厮守ぢ 2021-01-12 03:45

I\'m having trouble generating a timestamp in a Windows batch file, because I get diferent date formats on different Windows versions.

My machine:

&g         


        
5条回答
  •  借酒劲吻你
    2021-01-12 04:23

    Use VBScript if you want to get independent date time settings:

    thedate = Now
    yr = Year(thedate)
    mth = Month(thedate)
    dy = Day(thedate)
    hr = Hour(thedate)
    min = Minute(thedate)
    sec = Second(thedate)
    WScript.Echo yr&mth&dy&hr&min&sec
    

提交回复
热议问题