Print Date in txt Output


  1. Posts : 1
    windows 10
       #1

    Print Date in txt Output


    I have a batch file that outputs a text file for results of ipconfig. How can I add a date to the top of the printed page?

    ipconfig /all > c:\users\[username]\ip_config.txt
      My Computer


  2. Posts : 4,666
    Windows 10 Pro x64 21H1 Build 19043.1151 (Branch: Release Preview)
       #2

    Use this:
    Code:
    DATE /T
    If you need time also use this:
    Code:
    TIME /T

    Or use this:
    Code:
    ECHO %DATE%
    Or:
    Code:
    ECHO %TIME%

    Or:
    Code:
    ECHO %DATE% %TIME%


    Print Date in txt Output-date_time.png

    Your full code could look like something like this:
    Code:
    @ECHO OFF
    
    ECHO %DATE% %TIME% > %USERPROFILE%\ip_config.txt
    IPCONFIG /ALL >> %USERPROFILE%\ip_config.txt
    Last edited by slicendice; 18 Apr 2018 at 14:05.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:42.
Find Us




Windows 10 Forums