Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Hello :)

 

I'm making a batch script to do backups on a Windows 2003 server, and a key part of it is getting the day name (Mon, Tue, Wed etc) using the date /t command (as below). The script works perfectly on Windows 2000, but when ran on 2003, all I get is dd/mm/yyy - no day name.

 

for /f "Tokens=1-4 Delims= " %%i in ('date /t') do set dayname=%%i

 

Anyone know how/where to get the day name in 2003 please? Thankyou! :)

Posted (edited)

You could offload that task by making a VBScript that outputs the current day name and then alter your batch for loop so that it sources the information from the script rather than the date command.

 

You would need to use the /nologo switch with cscript when you run it though to get rid of all the cscript info that comes up pre run.

 

edit:

nice simple bit of script to:

day.vbs

wscript.echo weekdayname(Weekday(Now()))

Edited by SYNACK

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...