Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: psichic
Added: Dec 4, 2020 6:01 PM
Views: 6
Tags: no tags
  1. @echo off
  2. :: pure batch command to print the date and time together in a console ...
  3. :: run with clip to paste the datetime string in any editor ...
  4. :: Example of set command with for ...
  5. :: With help on how to deal with spaces in command ...
  6. :: Usage: datetime
  7. REM Tip, link: https://stackoverflow.com/questions/5553040/batch-file-for-loop-with-spaces-in-dir-name
  8.  
  9. for /f "delims=" %%i in ('date /t') do set S1=%%i
  10. for /f "delims=" %%i in ('time/t ') do set S2=%%i
  11.  
  12. echo %S1% - %S2%