Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch file to activate a partition


30 Apr 2013   #1

W7 Ult x64
 
 
Batch file to activate a partition

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

My System SpecsSystem Spec
.

01 May 2013   #2
Microsoft MVP

 

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.
My System SpecsSystem Spec
02 May 2013   #3

W7 Ult x64
 
 

Quote   Quote: Originally Posted by gregrocker View Post
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 System SpecsSystem Spec
.


02 May 2013   #4
Microsoft MVP

 

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.
My System SpecsSystem Spec
03 May 2013   #5

W7 Ult x64
 
 

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 BIOS is the only sure way to boot an OS amongst many OSes in multiple physical disks.

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 System SpecsSystem Spec
03 May 2013   #6
Microsoft MVP

 

Use the bootable CD for this program for the very best tool for managing partitions, including How to Set Active/Inactive partition -Partition Wizard Video Help.
My System SpecsSystem Spec
03 May 2013   #7

W7 Ult x64
 
 

The utility appears re-packaged version of the one I am using.
My System SpecsSystem Spec
03 May 2013   #8
Microsoft MVP

 

What's repackaged about it? It's the top partitioning tool out there.
My System SpecsSystem Spec
03 May 2013   #9

W7 Ult x64
 
 

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 System SpecsSystem Spec
03 May 2013   #10
Microsoft MVP

 

To be safest you should always use the latest version boot disk at Partition Wizard.
My System SpecsSystem Spec
Reply

 Batch file to activate a partition




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:13 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33