Share via

Creating Filename using DATE in command file

Anonymous
2018-07-12T15:32:27+00:00

I am attempting to create filenames in a command file using the DATE command.  However, I want to change the format from day mm-dd-yyyy to yyyy-mm-dd and remove the day.  Here is an example: Webcam-2018-07-12.  Currently the DATE would make this Webcam-Thu 07-12-2018.  I found a bat file that has this code in it: %DATE:/=_% and can create the file name using this but not in the date format I wish to use.  Is there a way to change the date format so I can obtain the format that I wish to use?  Please help!

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2018-07-13T20:25:35+00:00

    I'm rusty on .bat files, but in PowerShell, the following will give you the string you want:

    get-date -Uformat "%Y-%m-%d"

    Keith

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-07-13T08:49:16+00:00

    Hi JMiller,

    We appreciate you being part of the community. We would love to help you on your query about creating filename using DATE command. However, the query's complexity is out of the community scope of support. We highly recommend that you post your query on Social Technet, where in the said forum site, our programmers, code specialists and IT professionals share their great ideas to anyone who would ask.

    Should there be more that you would want to share to the community about product related ideas and concerns, please feel free to generate new post.

    Kind regards.

    Was this answer helpful?

    0 comments No comments