2013. 5. 2.

how to assign date to variable on command prompt of MS windows.

I need to make batch file which generates some logs. File names must be based on date_time



1) new file from text editor  (ex: file name is make_log.bat) 
     type below.

 SET DT=%date%     REM we can get current date from %data%
 SET LOG_NAME = %date%_.log   REM  2013-01-01_.log 
 DIR > %LOG_NAME%


2) save
3) click  make_log.bat 


Enhanced by Zemanta

댓글 없음:

댓글 쓰기