Day of week in batch

Argomenti vari di carattere sistemistico
Post Reply
daniele
Posts: 333
Joined: 04 Mar 2009, 13:59

Day of week in batch

Post by daniele »

A partire da Windows XP il formato del comando DATE non riporta il giorno della settimana.

Qui di seguito lo script per estrarre il giorno della settimana:

@echo off
echo.|command /C date|find "Current" > "%tmp%\weekday.tmp"
for /f "tokens=4" %%a in ('type "%tmp%\weekday.tmp"') do set weekday=%%a
del "%tmp%\weekday.tmp"

if %weekday%==Mon goto :mon
if %weekday%==Tue goto :tue
if %weekday%==Wed goto :wed
if %weekday%==Thu goto :thu
if %weekday%==Fri goto :fri
if %weekday%==Sat goto :sat
if %weekday%==Sun goto :sun


:SUN
exit

:MON
exit

:TUE
exit

:WED
exit

:THU
exit

:FRI
exit

:SAT
exit
Post Reply