日期:2014-05-17  浏览次数:20920 次

谁知道在bat中怎么提取系统时间
在bat中提取系统时间后进行判断,如果是1日,把文件拷贝到文件名为1的文件夹里;如果是10日,把文件拷贝到文件名为10的文件夹里;如果是20日,把文件拷贝到文件名为20的文件夹里

------解决方案--------------------
BatchFile code
@echo off
rem 假设系统日期格式为:2009-06-14 星期日
set day=1%date:~5,2%
set /a day%%=100
copy /y "C:\test\a.txt" "C:\test\%day%"

------解决方案--------------------
探讨
BatchFile code
@echo off
rem 假设系统日期格式为:2009-06-14 星期日
set day=1%date:~5,2%
set /a day%%=100
copy /y "C:\test\a.txt" "C:\test\%day%"



------解决方案--------------------
time /t
------解决方案--------------------
rem for DOS/NT
echo exit|%comspec% /k prompt $T$_ | find ":" > time.txt
------解决方案--------------------
@echo on
rem supoose the current date is 2009-6-15
rem this bat file will make a file at c:\ as 15 and copy the c:\file into file
ren if you don't want to get out the command you can change the code as @echo off
date /t
set day=1%date:~9,2% 
@echo make file as date time .for example 15
md c:\%day%
echo the "c:\files " means what file you want to copy to the datetime file
echo copy /y "c:\file" "c:\%day%"
------解决方案--------------------
date
time/t