Running batch files before Windows loads

J

JR

Another odd question from Somerset! Having trolled the various resources I
still can not find the answer, so here goes!

I have a duel boot with Win98/dos and win2k. I have a batch file that I
wish to run BEFORE windows loads that deletes all the index.dat files plus
many more, including emptying the temp folder.

The batch file works fine from win98 dos. Runs as command promt (but
obviously can not delete protected files).

I know can call it from the registry startup commands, but how do I run it
before windows even loads, preferably before the boot menu comes up?
Autoexec.bat doesn't run of course for Win2k and neither does a *.cmd batch
file.
 
P

Pegasus \(MVP\)

JR said:
Another odd question from Somerset! Having trolled the various resources
I
still can not find the answer, so here goes!

I have a duel boot with Win98/dos and win2k. I have a batch file that I
wish to run BEFORE windows loads that deletes all the index.dat files plus
many more, including emptying the temp folder.

The batch file works fine from win98 dos. Runs as command promt (but
obviously can not delete protected files).

I know can call it from the registry startup commands, but how do I run it
before windows even loads, preferably before the boot menu comes up?
Autoexec.bat doesn't run of course for Win2k and neither does a *.cmd
batch
file.

Use the Task Scheduler (via the Control Panel) to schedule a job
at boot time. It should invoke a batch file of your own choice that
you use to delete whatever files you wish to delete.
 
J

JR

Thanks, but I do not have task scheduler on this win2k machine as dissabled
and removed long ago when tidying up a few items (I love twiddling!) and no
option to add scheduled tasks.

When a new program is installed it often runs a batch file before booting
windows, such as using Partition Magic to alter partitions.

What I would like to find is how this works.

I believe it is a "run" command or similar in winini.ini - but can find
little documentation!

Any other suggestions/help please
 
P

Pegasus \(MVP\)

JR said:
Thanks, but I do not have task scheduler on this win2k machine as
dissabled
and removed long ago when tidying up a few items (I love twiddling!) and
no
option to add scheduled tasks.

When a new program is installed it often runs a batch file before booting
windows, such as using Partition Magic to alter partitions.

What I would like to find is how this works.

I believe it is a "run" command or similar in winini.ini - but can find
little documentation!

Any other suggestions/help please

You really need the Task Scheduler. I do not think it's a good idea
to delete Windows components unless you know exactly what
you're deleting.

AFAIK, you can re-install the Task Scheduler by re-installing
IE6. Just download the latest version from the Microsoft site.
Alternatively you can right-click c:\winnt\mstask.inf, then select
"Install".

PQMagic probably runs a service to perform tasks at boot
time. Creating your own service would be far more time
consuming than creating a scheduled task, with exactly the
same end result.
 
J

JM

quoting:
Another odd question from Somerset! Having trolled the various resources I
still can not find the answer, so here goes!

I have a duel boot with Win98/dos and win2k. I have a batch file that I
wish to run BEFORE windows loads that deletes all the index.dat files plus
many more, including emptying the temp folder.

The batch file works fine from win98 dos. Runs as command promt (but
obviously can not delete protected files).

I know can call it from the registry startup commands, but how do I run it
before windows even loads, preferably before the boot menu comes up?
Autoexec.bat doesn't run of course for Win2k and neither does a *.cmd batch
file.


I have used AutoExNT on my server to start a few things at the system level
before any user logs on. It makes a sevice that runs
%systemroot%/system32/AUTOEXNT.BAT See
http://www.ss64.com/ntsyntax/autoexec.html
 
J

JR

Many thanks. Just the job!

After a long search, found somewhere to download from, as not on any of my
w2kpro or server CDs in the tool kit.

Anyway, will try to set up tomorrow.

Assume, unless told otherwise, should be like a DOS batch file

rgds
Somerset
UK
 
J

JR

OOOppppppssss
Sorry, more questions!

Have run the set up and installed the batch file etc. etc. as per the
microsoft instructions.

Problem. Seems to run AFTER login.

WIn2k pro machine. Autolog in as administrator using Tweak.

First run, Zonealarm firewall trapped it, so ran AFTER ZA loaded, after log
in.

Stopped ZA but still runs after log in.

As trying to delete all index.dat files, obviously won't delete them once
Windows running.

Any other ideas? Like to run in boot process (when windows sometimes checks
for hard disk errors)? Lines in autoexnt.bat are simple like erase
\I:\cache\index.dat /q/f
sorry to be a pain, but must be able to be done somehow.....or am I missing
something in the install of autoexnt?

p.s. loaded task scheduler. Same problem. won't delete index files as
starts too late!
 
P

Pegasus \(MVP\)

JR said:
OOOppppppssss
Sorry, more questions!

Have run the set up and installed the batch file etc. etc. as per the
microsoft instructions.

Problem. Seems to run AFTER login.

WIn2k pro machine. Autolog in as administrator using Tweak.

First run, Zonealarm firewall trapped it, so ran AFTER ZA loaded, after
log
in.

Stopped ZA but still runs after log in.

As trying to delete all index.dat files, obviously won't delete them once
Windows running.

Any other ideas? Like to run in boot process (when windows sometimes
checks
for hard disk errors)? Lines in autoexnt.bat are simple like erase
\I:\cache\index.dat /q/f
sorry to be a pain, but must be able to be done somehow.....or am I
missing
something in the install of autoexnt?

p.s. loaded task scheduler. Same problem. won't delete index files as
starts too late!

You may have to use pendmoves and movefile:
http://www.microsoft.com/technet/sysinternals/FileAndDisk/pendmoves.mspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top