How do we get time stamp with file name by using batch script in Windows Server 2022 Datacenter 64-bit Version 21H2(Build 20348.1487)

Moulali.D 0 Reputation points
2023-01-18T08:00:23.2133333+00:00

I am unable to get the time stamp in file name by using batch script in Windows Server 2022 Datacenter 64-bit Version 21H2(Build 20348.1487). Could you please help me on this.

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 44,766 Reputation points
    2023-01-19T14:28:38.85+00:00

    Hello,

    In CMD batch files generally the solution is quite simple — we should use the %date% and %time% built-in variables, that display date and time based on the regional coding.

    for date

    echo %date%

    for time

    echo %time%

    just add in front of output file name in connect script for example - "D:\path\outfile_%date%%time%"


    --If the reply is helpful, please Upvote and Accept as answer-

    1 person found this answer helpful.

  2. Anonymous
    2023-01-26T05:55:16.4966667+00:00

    Hi,

    Maybe you can post this script requirement in github or stack overflow forums as there are more specialists on script topics.

    https://github.com/microsoft
    https://stackoverflow.com/

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.