1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

diskpart

Discussion in 'Software Development' started by madtrapper, Nov 10, 2009.

Thread Status:
Not open for further replies.
  1. madtrapper

    madtrapper Thread Starter

    Joined:
    Mar 24, 2006
    Messages:
    17
    how do i make a bat using
    DISKPART>
    DISKPATR> list disk
    DISKPART> select (disk2)
    DISKPART> clean all

    thanks
     
  2. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    Code:
    Set _Script=dscript.txt
    >"%_Script%" Echo.List Disk
    >>"%_Script%" Echo.Select Disk 2
    >>"%_Script%" Echo.Clean All
    >>"%_Script%" Echo. Exit
    Diskpart /s "%_Script%"
    Del "%_Script%"
    This will completely erase Disk 2 without confirmation, and will take some time as it writes zeros to each sector. It might be better to do this in 2 parts, to list the disks first, then ask for the disk number to erase (clean), confirm the selection with the appropriate warnings, then do the clean operation. Running this on the wrong PC could be disastrous, as the data on the disk will not be recoverable.

    If there is no Disk 2, it will simply error on both the Select and Clean commands then exit.

    Also, on Vista or later, the batch file will have to be run as Administrator
     
  3. madtrapper

    madtrapper Thread Starter

    Joined:
    Mar 24, 2006
    Messages:
    17
    thanks trapper
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/876119

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice