anon.ms anon ms it guy: more than break-fix

15Oct/100

Getting the Day Name from CLI

hey,

echo %date% only shows the day name if your short date format is: "d/MM/yyyy"
returns: "Fri 15/10/2010"

Which lets you do this:
echo %date:~0,3% to get "Fri"

This doesnt work when the date format has changed!

So, in script:
reg add "HKCU\Control Panel\International" /v "sShortDate" /t REG_SZ /d "d/MM/yyyy" /f
rem change format to get day
echo %date:~0,3%
rem get day
reg add "HKCU\Control Panel\International" /v "sShortDate" /t REG_SZ /d "dd/MM/yy" /f
rem change it back

Scheduled xcopy backup anyone?

xcopy d:\data\*.* c:\Backups\%date:~0,3%\ /e /v /c /h /r

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.