How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?

前端 未结 28 2919
别跟我提以往
别跟我提以往 2020-11-21 05:28

Update: Now that it\'s 2016 I\'d use PowerShell for this unless there\'s a really compelling backwards-compatible reason for it, particularly because of the regional setting

28条回答
  •  清歌不尽
    2020-11-21 06:03

    http://sourceforge.net/projects/unxutils/files/

    Look inside the ZIP file for something called "Date.exe" and rename it "DateFormat.exe" (to avoid conflicts).

    Put it in your Windows system32 folder.

    It has a lot of "date output" options.

    For help, use DateFormat.exe --h

    I'm not sure how you would put its output into an environment variable... using SET.

提交回复
热议问题