Batch file to activate a partition

churin

New member
Power User
Local time
10:07 PM
Messages
341
Location
California
I want to create a batch file to activate a partition. Idea is to create two such batch files to switch active partition. What I want to automate is the following commands:

diskpart
list disk
select disk 0
list partition
select partition 1
active

Help is appreciated.

Edit: The problem has been resolved. For those who might be interested, the solution is as follows:
Create a batch file named as Batchfile for example, and a text file named as Script for example.

Enter a statement in the Batchfile.bat as follows:

Code:
diskpart /s Script.txt
Enter statements in the Script.txt as follwos:

Code:
list disk
select disk 0
list partition
select partition 1
active
Then, save the two files in a same folder.
Another set of files as above need be created to activate partition 2.

Note that one needs to know the disk number and the partition number to be used in the Script.txt for his/her situation. They can be determined by using Disk Management(Computer->manage->Disk Management).
 
Last edited:

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
If you'll tell us why you want to do this we may have some other suggestions based on handling countless thousands of partition cases here.
 
If you'll tell us why you want to do this we may have some other suggestions based on handling countless thousands of partition cases here.
Simply because I want to switch OS. What I need is a simple self-standing utility which lists all disks and their primary partitions and allows me to select any primary partition to activate.
Your suggestion is appreciated.
 

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
The best way to do what you want is to install EasyBCD (click Download - no Name or Email required)
to add the other OS's on the Add OS Menu tab.

A Dual boot will install the boot files on the first-installed OS so that changing the Active flag requires repairs to rewrite the System boot files to the partition you change to Active later. This is cumbersome and unnecessary when you can choose from a Boot Menu the OS you want to boot - even hide it when not needed.
 
Thanks for your reply. I am aware of the EasyBCD and the dual-boot system mentioned.

In my particular case, there could be several disks each of which may have two or three OSes. And the combination of those disks varies depending on a situation.
I have come to think that changing partition flag and using disk menu generated by [FONT=&quot]BIOS is the only sure way to boot an OS amongst many OSes in multiple physical disks.
[/FONT]
I have a stand-alone utility to change the flag but it works only for Disk 0. For a disk other than Disk 0, I am using one of the popular disk management utilities to change the flag.
 

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
The utility appears re-packaged version of the one I am using.
 

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
What's repackaged about it? It's the top partitioning tool out there.
 
The software you referred to is identical to the one I am using. I call one of them is "repackaged" version of the other. I am using mine since 2009, but I do not know for sure which company developed the software. The companies involved must have business agreement for them to sell the same thing by their own brand.
 

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
I do not mean I am using the same version since 2009.;) I started using version 4.1 and now it is version 9.2.2.
Thanks for letting me know an alternate source.
 

My Computer

Computer type
PC/Desktop
OS
W7 Ult x64, W8 Pro x64 and W10 Pro x64
CPU
Phenom FX6300
Motherboard
Gigabyte GA-970A-UD3 rev. 1.2
Memory
16GB DDR3 1866 G.Skill F3-1866C9D-16GWM x2
Graphics Card(s)
Radeon R7 360
Sound Card
Asus Xonar DS
Monitor(s) Displays
27" x2, Dell P2715Q
Screen Resolution
3840 x 2160
Hard Drives
Samsung 850Pro 1TB SSD - system
Samsung 4TB SSD - Data
PSU
Corsair CX450M
Case
Corsair 200R
Cooling
Zalman CNPS5X Performa
Internet Speed
400Mbps/12Mbps
Other Info
2nd machine: Same as above
3rd machine: Apple MacAir with W7 Ult installed
Back
Top