Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Bash
Posted by: Stefan Wendelmann
Added: Aug 23, 2018 9:49 AM
Views: 3
Tags: no tags
  1. @echo off
  2. set hour=%time:~0,2%
  3. if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
  4. set min=%time:~3,2%
  5. if "%min:~0,1%" == " " set min=0%min:~1,1%
  6. set secs=%time:~6,2%
  7. if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
  8. set year=%date:~-4%
  9. set month=%date:~3,2%
  10. if "%month:~0,1%" == " " set month=0%month:~1,1%
  11. set day=%date:~0,2%
  12. if "%day:~0,1%" == " " set day=0%day:~1,1%
  13. Set MaDate=%day%/%month%/%year%
  14. Set MyTime=%hour%:%min%:%secs%
  15. set DateTimeFile=%year%_%month%_%day%_%hour%_%min%_%secs%
  16. set LogFile=.\log\%DateTimeFile%_migrateSQLcmd.log
  17.  
  18. if not exist "log" mkdir log
  19.  
  20. echo %date%, %time%: Migrating form migrateSQLcmd.bat > %LogFile%