Batch File Question

Author Message
gdewrance

  • Total Posts : 591
  • Scores: 3
  • Reward points : 0
  • Joined: 3/16/2006
  • Status: offline
Batch File Question Tuesday, June 13, 2006 9:13 PM (permalink)
0
Original message moved by Country73
Reason : Moved to a more suitable forum
Who knows how to alter this to use Diskpart to remove NTFS drives. At the moment this only does FAT.
@ECHO OFF
IF EXIST "A:\FORMAT.TXT" GOTO FORMAT
IF NOT EXIST "A:\FORMAT.TXT" GOTO FDISK

:FDISK
ECHO This system will reboot when complete.
ECHO.
ECHO Deleting all current partitions ...
FDISK /CLEAR > NUL
ECHO Creating new partitions ...
FDISK /AUTO > NUL
ECHO. > A:\FORMAT.TXT
GOTO REBOOT

:REBOOT
FDISK /REBOOT

:FORMAT
ECHO Formatting drive ...
FORMAT drive /AUTOTEST /V:label /S
DEL A:\FORMAT.TXT
GOTO END
:END
CLS
ECHO FINISHED FDISK AND FORMAT

 
#1
    mbouchard

    • Total Posts : 2110
    • Scores: 29
    • Reward points : 0
    • Joined: 5/15/2003
    • Location: USA
    • Status: offline
    RE: Batch File Question Friday, June 16, 2006 12:54 AM (permalink)
    0
    Diskpart can make use of an answer file.

    Here is one that I use in my Windows Setup process

    My answer file
     select disk 0
     clean
     create partition primary 
     assign letter=C
     active
     exit
     


    The command you would use
    Diskpart /s c:\folder\nameoffile.txt

    Now, what does the above command do.

    select disk 0 - Select the first disk on the PC
    clean - wipes the drive clean, removing all partitions (i.e. if you had 2 partitions when you started, they would be gone)
    create partition primary - create the partition
    assign letter=C - assign the above partition the letter C
    active - make the above partition active
    exit - exit diskpart

    Once this was done, all you would have to do is format the drive with whatever FS you want.

    Mike

    For useful Scripting links see the Read Me First stickey!

    Always remember Search is your friend.
     
    #2
      gdewrance

      • Total Posts : 591
      • Scores: 3
      • Reward points : 0
      • Joined: 3/16/2006
      • Status: offline
      RE: Batch File Question Monday, June 19, 2006 1:19 AM (permalink)
      0
      I tried this. It gave me an error that it could not be run in DOS.
      Can it step through all partitions and delete them
      @ECHO OFF
      IF EXIST "A:\FORMAT.TXT" GOTO FORMAT
      IF NOT EXIST "A:\FORMAT.TXT" GOTO FDISK


      :FDISK
      Diskpart /s A:\DiskpartFormat.txt
      GOTO REBOOT

      :REBOOT
      FDISK /REBOOT

      :FORMAT
      ECHO Formatting drive ...
      FORMAT C: /AUTOTEST /S
      DEL A:\FORMAT.TXT
      GOTO END
      :END
      CLS
      ECHO FINISHED FDISK AND FORMAT

      NOTE: My DiskpartFormat.txt is what you posted.
       
      #3
        mbouchard

        • Total Posts : 2110
        • Scores: 29
        • Reward points : 0
        • Joined: 5/15/2003
        • Location: USA
        • Status: offline
        RE: Batch File Question Monday, June 19, 2006 11:36 PM (permalink)
        0
        FDisk <> Diskpart.

        Diskpart is, essentially, a 32bit version of FDisk.  I had thought you were looking at switching from FDisk to DiskPart.  As far as I know, you can not run diskpart in DOS.
        Mike

        For useful Scripting links see the Read Me First stickey!

        Always remember Search is your friend.
         
        #4
          gdewrance

          • Total Posts : 591
          • Scores: 3
          • Reward points : 0
          • Joined: 3/16/2006
          • Status: offline
          RE: Batch File Question Monday, June 19, 2006 11:49 PM (permalink)
          0
          There used to be a third party app called diskpart that I used on NT4 that was dos based.
          I think there might be one on Hirens Boot CD. I will have a look and see what I can find.
          I tried free Fdisk but, still need to see if its got command line switches.
          Thanks for the help
           
          #5
            mbouchard

            • Total Posts : 2110
            • Scores: 29
            • Reward points : 0
            • Joined: 5/15/2003
            • Location: USA
            • Status: offline
            RE: Batch File Question Tuesday, June 20, 2006 7:43 AM (permalink)
            0
            Ahh, wasn't aware of the 3rd party app.  The Diskpart I use came from MS, with 2000/XP
            Mike

            For useful Scripting links see the Read Me First stickey!

            Always remember Search is your friend.
             
            #6
              gdewrance

              • Total Posts : 591
              • Scores: 3
              • Reward points : 0
              • Joined: 3/16/2006
              • Status: offline
              RE: Batch File Question Friday, July 21, 2006 2:11 AM (permalink)
              0
              My mistake its Delpart
               
              #7

                Online Bookmarks Sharing: Share/Bookmark

                Jump to:

                Current active users

                There are 0 members and 1 guests.

                Icon Legend and Permission

                • New Messages
                • No New Messages
                • Hot Topic w/ New Messages
                • Hot Topic w/o New Messages
                • Locked w/ New Messages
                • Locked w/o New Messages
                • Read Message
                • Post New Thread
                • Reply to message
                • Post New Poll
                • Submit Vote
                • Post reward post
                • Delete my own posts
                • Delete my own threads
                • Rate post

                2000-2012 ASPPlayground.NET Forum Version 3.9