How to get a UNIVERSAL Windows batch file timestamp

前端 未结 5 1673
独厮守ぢ
独厮守ぢ 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:18

    Unfortunately, it can't be done directly, so you need to resort to hacks like GetDate.cmd.

    There are lots of VBScript and small external commandline tools available too, which isn't something I'd take a dependency on unless you're already using something of that nature in your overall system.

    Personally, I'd be trying to route around it by using PowerShell which neatly sidesteps the issue completely.

提交回复
热议问题