Jump to content

Reboot during batch


Recommended Posts

Hi,

I am successfull automating the install of windows - however, during the software installation which runs from a batch file, I want to do a reboot. How can I reboot and then the batch file continue from where it stopped to reboot?

TIA

OLI

Link to comment
Share on other sites


Yes, id already searched the forum before i posted!

Im very confused and new to all this... Ive attached my batch file that is installing the software and inserted some lines near the bottom detailing what I want to do. Can you please give me some instuctions? This file runs on first logon.

Many thanks in advance.

Oli

software.cmd

Link to comment
Share on other sites

Indeed, it seems a bit strange.. As I see it you could just reboot after the last installation is complete. But if you really want to reboot in between and then continue from that point you need to make the last commands into separate cmd files and just use REG.exe to add the cmdfiles into RunOnce

I personally like using poweroff.exe to reboot.

I use the following commandline with it:

poweroff.exe reboot -force -nocancel -warn -warntime 25 -msg "Windows 2000 will now restart in 25 seconds for the installation to be complete."

You can get it from http://users.pandora.be/jbosman/poweroff/poweroff.htm

Place the poweroff.exe to the $OEM$\$$\system32 folder and then make your batch run that commandline.

Link to comment
Share on other sites

Well, it's your call. I just think it serves no point to reboot twice in between.

So, you should add this to your first command file.

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

REG ADD %KEY% /V 1 /D "%systemdrive%\path_to_file\software2.cmd" /f

And then just add another like that to your next command file (two reboots, three files in total)

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

REG ADD %KEY% /V 1 /D "%systemdrive%\path_to_file\software3.cmd" /f

Link to comment
Share on other sites

That is to run your software2.cmd after a reboot.

After the line above, you should have this (on WinXP):

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in a minute...          This will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

shutdown.exe is part of windowsXP itself so no extra files to be downloaded.

Link to comment
Share on other sites

I know it isn't complicated, I looked it through. But I'm still saying that it's harder for someone understand if he has just started working on commandfiles. It can be made a lot simpler (but maybe not as "neat") with multiple files. It's up to the poster to decide which method to use :)

Link to comment
Share on other sites

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...