Need to run a script on startup

Martyuk39

Member
Jun 5, 2004
187
0
0
OK - the computer switches on automatically at say 8am. I've managed that bit.

Then when Windows starts up it runs a script. I want it to do slightly different things depending on what day of the week it is.

I've been using DOS - sorry, XP command lines in batch files. But I haven't found a command for the day of the week.

Either

Have I overlooked anything

Or

Is there a simple programming tool (preferably free!) that I could use?

I have done some programming, but not for many years. So I repeat the word simple...

Thanks
Martin
 

Martyuk39

Member
Jun 5, 2004
187
0
0
Not really - although I'm currently downloading VB Express - I'll see if there's anything there
Thanks
 

Billb2

Diamond Member
Mar 25, 2005
3,035
70
86
Originally posted by: Martyuk39..do slightly different things depending on what day of the week it is.

Have I overlooked anything
In a batch file you can use edlin to pull the date from the Dir command. Just create an empty file, pipe a Dir command of the directory with the empty file to another file and use edlin to delete everything except the file's day of creation (today). Then you can key off that with for-in-dos or whatever.
 

Martyuk39

Member
Jun 5, 2004
187
0
0
Now that's clever. Edlin - I'd forgotten that existed!

I've managed that, although it's giving me the date, not the day of the week. That's the thing I'm after. I could get the date simply by typing "date /t"

Clearly I'm missing something in what you said - how do I get to the day of the week?
 

Martyuk39

Member
Jun 5, 2004
187
0
0
I've found a site with lots of information on, including how to get the day of the week here - I think that's the work of a genius.

So I've got the day of the week.

Now I've realised I could actually do with the time of day - ^%&$& Sunday opening hours in the UK.

I'd like the time of day - I can get that into a text file, say 20:17 as it is here at the moment.

In a batch file you can use edlin to pull the date from the Dir command. Just create an empty file, pipe a Dir command of the directory with the empty file to another file and use edlin to delete everything except the file's day of creation (today). Then you can key off that with for-in-dos or whatever.

I would like to say "if the time is less than 10am" etc
I can't figure out how to do it. I'd like to delete everything in the file except the 20. I think.
 

Martyuk39

Member
Jun 5, 2004
187
0
0
The only thing I did in QBasic was play that game where you threw the thing at different trajectories. Those were the days! What was it called?

I'll get by without the time for the moment. I downloaded QBasic and figured out how to store the time of day in a variable, but not the day of the week. I'll figure it out eventually.

I'll just make do with the day of the week using the batch file I've done for now.
 

Martyuk39

Member
Jun 5, 2004
187
0
0
Batch file worked fine on my Vista machine, but when I run it on my XP machine I get "out of environment space"

Help!
 

kevinthenerd

Platinum Member
Jun 27, 2002
2,908
0
76
Originally posted by: Martyuk39
Batch file worked fine on my Vista machine, but when I run it on my XP machine I get "out of environment space"

Help!

You'd have to post some offending code to get any help, I suppose.
 

Martyuk39

Member
Jun 5, 2004
187
0
0
I've abandoned the batch files - I found when I double-clicked on the batch file on my Vista machine I got the same. So I never really had it working at all.

I've found a small vb script which I'm modifying, but see below:

dtmToday = Date()

dtmDayOfWeek = DatePart("w", dtmToday)

Select Case dtmDayOfWeek
Case 2 Wscript.Echo "Monday"
Case 3 Wscript.Echo "Tuesday" etc etc

so for Tuesday I'd scrap the screen output and run my little files

Case 3 Set objShell = CreateObject("Wscript.Shell")
objShell.Run("one of my little scripts.bat")

I need to change the working directory to the one with all the scripts in - in the olden days "cd scripts" or add it to the path or whatever. I don't know how to do that in vb.