• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need to run a script on startup

Martyuk39

Member
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
 
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.
 
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?
 
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.
 
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.
 
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.
 
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.
 
Back
Top