|Thank you Wahine and Judago,|
I tried testing it on my XP machine, and came to the following results:
It is now almost there, but I did not understand how to actually implement Judago's comment! Working out how to do this might resolve the second half of my problem, but.....
What I have now is a day.bat file (to test the script):
%temp%\vbs.vbs echo wscript.echo weekdayname(Weekday(Now^)^)
for /f "tokens=*" %%1 in ('cscript //nologo %temp%\vbs.vbs') do (set day=%%1)
echo Current day is %day%
I put the last line in to display the variable day.
This initially brings up a "Windows Script Host" window with "Wednesday" in it after running the first line, but this requires me to hit "OK" for it to continue
......then it displays:
Current day is day:~0,3
so it looks as though the "set day=%day:~0,3%" has overwritten the extracted day of the week, rather than just extracting the first three characters as desired.
How do I prevent the need for user interaction, and then not overwrite the clever Cscript extraction of the day of the week!!
BUT then I tried it on the Windows 2003 server machine, and had far worse results, as it reported that :
'c:\documen~1\AdminT~1\Locals~1ztemp\2\vbs.vbs' is not recognized as an internal or external command, operable program or batch file.
Does this mean that I am missing something on the Windows 2003 server which is required to run the Cscript?
As you can tell my scripting skills are limited!
Many thanks in anticipation,