Batch file to activate a partition

Page 1 of 2 12 LastLast

  1. Posts : 341
    W7 Ult x64, W8 Pro x64 and W10 Pro x64
       #1

    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).
    Last edited by churin; 01 May 2013 at 08:37. Reason: moved to new thread for better support
      My Computer

  2.    #2

    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 Computer


  3. Posts : 341
    W7 Ult x64, W8 Pro x64 and W10 Pro x64
    Thread Starter
       #3

    gregrocker said:
    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

  4.    #4

    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 Computer


  5. Posts : 341
    W7 Ult x64, W8 Pro x64 and W10 Pro x64
    Thread Starter
       #5

    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 Computer

  6.    #6

    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 Computer


  7. Posts : 341
    W7 Ult x64, W8 Pro x64 and W10 Pro x64
    Thread Starter
       #7

    The utility appears re-packaged version of the one I am using.
      My Computer

  8.    #8

    What's repackaged about it? It's the top partitioning tool out there.
      My Computer


  9. Posts : 341
    W7 Ult x64, W8 Pro x64 and W10 Pro x64
    Thread Starter
       #9

    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

  10.    #10

    To be safest you should always use the latest version boot disk at Partition Wizard.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About 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 13:30.
Find Us