问个简单的BAT脚本问题.解决者送全分
转转猴有个很弱智的问题,大家帮下忙.在BAT脚本中.如何获取系统时间并将之放在变量中?
@SET SYS_TIME = ?
我用HELP命令查了下,只有DATE /T 获取 系统日期 TIME /T 获取 系统时间
我要做的是在Windows下根据当前时间以系统日期+时间的组合方式生成一个目录.
挺简单的东西,但是BAT脚本玩得少,大家会的说一声.谢谢. --------------------编程问答--------------------
@ECHO OFF--------------------编程问答-------------------- http://www.robvanderwoude.com/datetime.php#Prompt --------------------编程问答--------------------
:: DateTime.bat
:: Set environment variables with current Date, Time and DayOfWeek
:: Recursion
IF NOT "%3"=="" GOTO SecondTime
:: Create temporary batch file
> TEMPDTT1.BAT ECHO @PROMPT %0 $D $T
:: Do _N_O_T_ replace "COMMAND /C" with CALL in the next line
> TEMPDTT2.BAT COMMAND /C TEMPDTT1.BAT
TEMPDTT2
:SecondTime
DEL TEMPDTT?.BAT
SET DOW=%1
SET DATE=%2
SET TIME=%3
:: Remove forward slashes from DATE variable and store result in DATE2
IF EXIST DATE2.BAT DEL DATE2.BAT
SET DATE2=
:: Parse DATE variable and create temporary batch
:: file to recreate DATE without forward slashes
>> DATE2.BAT FOR %%A IN (/%DATE%) DO ECHO SET DATE2=%%DATE2%%%%A
CALL DATE2.BAT
DEL DATE2.BAT
md %date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%
补充:.NET技术 , C#