Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to make a script to change boot order.  (Read 11052 times)

0 Members and 1 Guest are viewing this topic.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
How to make a script to change boot order.
« on: July 04, 2017, 12:22:52 AM »
This is something I would like to do, but have no idea if it is even possible.  ???

My current machine is a Dell 755 and I can program the BIOS  to start the machine automatically at 2 AM every weekday morning. This saves me the needs of getting up early and starting up the machine to get the updates. Getting updates during the day daytime hours can be time-consuming and in some cases not even possible because of heavy Internet traffic. So, my idea is to let the computer do it by starting up the machine automatically at two o'clock in the morning and  get updates.  :D

So far so good. But here's the big problem. Presently I have this machine in a triple boot configuration with Windows XP, Windows 7, and Windows 10 and automatic updates are turned on.  O0

But here's the problem. I need to remember to set the boot default  option to change to a different operating system for different days of the week. I could have Windows XP to the update on Wednesday, followed by Windows 7 on Thursday and then Windows 10 early Friday morning. But the trick is to have a script that will change the boot order for those three days.   :-\

So my question is, is there some way to write a script in some kind of scripting language that would change the defajult boot  OS for those three days?
Any suggestions would be welcome . Thank you .   :)

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: How to make a script to change boot order.
« Reply #1 on: July 04, 2017, 07:54:33 AM »
Quote
is there some way to write a script in some kind of scripting language that would change the defajult boot  OS for those three days?
No.

I mean, if you can get direct hardware access, find the location of the CMOS RAM, figure out the data format which is typically entirely undocumented, and change the appropriate bytes to adjust the boot order and then update the checksum with the correct algorithm, then maybe.

And if it's stored in the ESCD, as it is in some systems, you have to deal with not only knowing the format but now being able to flash the entire block, the mechanisms for which differ from one system to another.
I was trying to dereference Null Pointers before it was cool.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: How to make a script to change boot order.
« Reply #2 on: July 04, 2017, 11:44:39 AM »
Tnaks BC.
The boot loader I am using is not in the BIOS, but it is the loader Windows 10 installs when It finds yhour halready have a windows instalation. Not wure how it works. Somehow it makes windows 10 "flip" and allow another system, Windows 7 or Windowsd XP, finish the boot process. I have no idea if it is an utility taht has options inside of Windows. But I am sure it is not a BIOS thing. I only have one drive in the system, and tmy Dell 755 BIOS is before UEFI came. So it is some kind of software that is on the hard drive boot area.


BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: How to make a script to change boot order.
« Reply #3 on: July 04, 2017, 01:20:23 PM »
In that case, bcdedit /default in an administrator command prompt under Win10 sets the default. It might work with Win7 but you won't be able to change it from Windows XP to go "back".

You can use bcdedit /bootsequence to do it one time.

bcdedit /? has more info.
I was trying to dereference Null Pointers before it was cool.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: How to make a script to change boot order.
« Reply #4 on: July 04, 2017, 05:01:44 PM »
OK. I took a look at the BCDedit options.
It looks like thaey afre the same in Windows 7 and Windoqws 10. But, there is a problem. I get 'acesse denied' when I tyr to see the store on the command line. So this might be a dead end.

However, in WImdows 10 one can do a o9ne time switch to another OS and then after that other OS shuts down it will recvert back to windo9ws 10. That might be a posibility.

BTW, I need to ask this: If the PC boots up and waits for the user to logon, can takse run in the backgroun? If not, how do you get Win 10 s to automatically boot up and run something withoyut a user log in?

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: How to make a script to change boot order.
« Reply #5 on: July 04, 2017, 05:25:33 PM »
Quote
I get 'acesse denied' when I tyr to see the store on the command line.
Were you running in an Elevated command prompt?
I was trying to dereference Null Pointers before it was cool.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: How to make a script to change boot order.
« Reply #6 on: July 04, 2017, 05:28:32 PM »
You can use Task Scheduler to schedule a task to run at startup, and setting it to Run whether there is a user logged in or not allows it to run at the login screen. It can be configured to run under a specific user account as well. Thjey cannot present a UI, obviously.
I was trying to dereference Null Pointers before it was cool.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: How to make a script to change boot order.
« Reply #7 on: July 04, 2017, 06:14:11 PM »
Thanks, BC. Thatwil;l keep me busy for a month or so.  :D
I am going to play with the task scedk in Windows 10 and see what i can do for me.
I might consider just letting my  PC go into a sleep mode instead of do the full shutoff thiing. Soewhere I read taht the power used in sleep mode is vert little.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: How to make a script to change boot order.
« Reply #8 on: July 07, 2017, 11:54:04 AM »
Update. What I want to do has to be done with the Windows 10 boot loader.
Other sorces indicate that you can not swap the boot loaders.**  So I have to use BCDedit inside of WIndows 10, I can not use in in Windows 7, as far as I can tell.

What I want to do is to switch from OS to another without human interaction, My goal is to have both Windows 7 and Windows 10 get their respective updautes in the wee early hours of Wednedy morning,. Or maybe Thursday.

I can get Windows 10 to change the default boot entry and then reboot into Windows 7. But I can not get Windows  7 to reset the boot thing to go back to WIndows 10. So taht is as far as I can go with this. I have to reset it to Windoqws 10 manually the nect day.

I am going  to stop here,  a partial solution will be used.  8)

** GRUB is an exception, but I don't want to go that far!
https://www.youtube.com/watch?v=EgzLKOF4blY

« Last Edit: July 07, 2017, 12:07:29 PM by Geek-9pm »

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: How to make a script to change boot order.
« Reply #9 on: July 07, 2017, 12:45:54 PM »
Ignore my post above.
BCDedit works inside of both Windows 10 and Windows 7.
Anyway, uou can use BCSesuit inside Windowss 10 at an elevated pronpt and use bootsequence to do a one-time reboot into Windows 7. Inside Windows 7 you could either use BCdedit or jsut shutdown the system. The later works fine. Windows 10 with return as the default entry.
The trick is to understand the sybtax of the bootswquence command. The documentation is there, it is not very easy to understand for us average people.