Jump to content

How to schedule a bat/exe file to auto run when Win XP SP2 /SP3 reboot


Recommended Posts

Posted

Hi,

I haven’t been regular, and one post of mine was apparently deleted by some mod.

I went and read the sticky, and sure enough, it states that prolonged absence from the forum can result in a post being deleted.

Well, I’m trying to post again. Hope this one doesn’t get deleted.

Is there any way to write a cmd file to schedule a bat/exe file to auto run when Win XP SP2 /SP3 reboots ?


Posted

I'm not so sure on what you are asking. You need the cmd file to do the scheduling or you just need a cmd file to run when the computer reboots?

Just stick it in Start Menu > Programs > Startup if option 2

Type AT /? at a command prompt for scheduling

Posted

Thanks, -X-,

I am trying to make un unattended XP cd, without using nlite for the updates.

I want to apply the updates via cmd files, in multiple phases.

I need these cmd files to run in proper sequence, after each reboot.

I want to invoke a 'c' program when the pc has booted up. This program, will in turn start the appropriate cmd file.

I know this sound weird, but I want my unattended XP cd to remain simply a basic unattended cd.

I don't want to incorporate the updates via nlite.

Posted

I don't know what you mean by "invoke a 'c' program"

What I would do is use HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce to launch the cmd file. Then have the last line in the cmd file add a new runonce entry for the next cmd file, etc.

Posted (edited)

I tried the following:

SET KEY=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
REG ADD %KEY% /V MY_CMD /D "E:\Second.cmd" /f
pause
shutdown.exe -r -f -t 10 -c "Windows XP will now restart in 10 seconds"

and

SET KEY=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
REG ADD %KEY% /V MY_CMD /D "E:\Third.cmd" /f
pause
shutdown.exe -r -f -t 10 -c "Windows XP will now restart in 10 seconds"

It worked.

The first cmd file set the Second.cmd to run at startup, and it did.

The Second.cmd file set the Third.cmd to run at startup, and it did.

I have a couple of doubts.

1) The cmd file specified to run at startup, ran before all the applications had loaded.

2) If I remember right, after installing .net, the login window changes, and the machine does not login automatically. I had to use tweakui to enable the auto logon.

Should I use HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce instead of HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce ?

Edited by ravisunny2

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...