shrink and create new partition

Home Forums Scripting General Scripting shrink and create new partition

This topic contains 2 replies, has 2 voices, and was last updated by  mla 1 year, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts

  • mla
    Member
    #167183

    Hi,
    could somebody help…
    in Windows 7 with one full disk size partition I need:
    1. shrink C: partition to 20GB less
    2. create a new one from free space with drive letter D:

    no other drives attached… one HD inside.
    Thanks.


    Ossian
    Moderator
    #191791

    Sorry, I don’t have a canned solution, but you can do it with DiskPart
    Script examples: https://technet.microsoft.com/en-us/library/dn614984(v=ws.11).aspx
    Shrinking: https://technet.microsoft.com/en-us/library/cc731894(v=ws.11).aspx


    mla
    Member
    #309885

    Hi Ossian, don’t be sorry :) for not having a canned solution
    you helped not once and I appreciate…

    this what I did…

    created batch Partit.bat with the commands:

    pushd %~dp0
    diskpart /s resize.txt

    and placed along with it my resize.txt

    select volume 1
    shrink desired=20000
    select disk 0
    create partition primary
    select partition 3
    format fs=ntfs quick
    assign letter=d
    exit

    Perfectly works! I added first line in the batch “pushd %~dp0” because diskpart suddenly started to give an error…
    I have pretty complex scenario where I am copying some structure from the server to workstations… Brief it started behave…
    I don’t entered deep to the question but found a solid fix on web by using this line.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.