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
churin

W7 Ult x64 and W8 Pro 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
gregrocker

 

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
churin

W7 Ult x64 and W8 Pro 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
gregrocker

 

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
churin

W7 Ult x64 and W8 Pro 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
gregrocker

 

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
churin

W7 Ult x64 and W8 Pro x64
 
 

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

 

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

W7 Ult x64 and W8 Pro 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
gregrocker

 

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 Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How can I write a batch file that opens a file in a program?
I wrote this batch file which does what I want it to do so far. @echo off "C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe" "C:\Program Files (x86)\VideoLANold\VLC\vlc.exe" "C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe" exit
General Discussion
I need a batch file to open a random file within a certain folder/path
I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'. I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands,...
General Discussion
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
batch file open file for program in the startup folder
I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion


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

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App