wmic failure with concurrent calls on XP and Server 2003

前端 未结 2 860
渐次进展
渐次进展 2021-01-28 20:41

I am using wmic to get the time. I have narrowed this down to a one (1) line .bat file. I have learned from stackoverflow about piping stdin and stdout to avoid han

相关标签:
2条回答
  • 2021-01-28 21:06

    This works, there is no need for the type nul pipe.

    wmic os get localdatetime | findstr .
    
    0 讨论(0)
  • 2021-01-28 21:10

    I've never heard of the issue you are reporting.

    You could try getTimeStamp.bat - a hybrid JScript/batch utility that provides robust, locale independent, date and time computation and formatting. The utility is pure script using native Windows functionality.

    Assuming you have getTimeStamp.bat in your current directory, or better yet, somewhere in your path, then the following will create a variable named currentTimeStamp containing the current date and time in WMIC format.

    call getTimeStamp -f {yyyy}{mm}{dd}{hh}{nn}{ss}.{fff}000{zzzz} -r currentTimeStamp
    

    There are a great many formats available, as well as the ability to apply date and time offsets, etc. Full documentation is embedded within the script.

    0 讨论(0)
提交回复
热议问题