?
Solved

Batch file to automatically format drive

Posted on 2012-08-27
9
Medium Priority
?
13,072 Views
1 Endorsement
Last Modified: 2012-08-27
I am trying to create a script to automatically quick format a drive each day. So far I have this  
but it asks me for the volume name and I pipe it in but its not working.


echo ExchBackups
echo Y| format b: /q /x /FS:NTFS /v:ExchBackups
1
Comment
Question by:maximus81
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 13

Expert Comment

by:Xaelian
ID: 38336433
echo y | format E: /FS:NTFS /q

replace the E:  with the volume you want to format.
0
 

Author Comment

by:maximus81
ID: 38336447
I get this after running this:

The type of the file system is NTFS.
Enter current volume label for drive B: y
An incorrect volume label was entered for this drive.
0
 
LVL 13

Expert Comment

by:xDUCKx
ID: 38336462
8.3 naming convention.  Your volume label is too long.  Try

/v:Exch

That should do it.  Or enclose it in quotes:

/v:"ExchBackup"
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 13

Expert Comment

by:Xaelian
ID: 38336491
@echo off
format B: /q /autotest

the /autotest formats the drive without user interaction.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38336562
This works for me against a 1Gb USB stick, was FAT32 with a few files on changed label the ExchBackups then ran this:

C:\Users\stephen>echo ExchBackups|format f: /q /fs:NTFS /Y /v:ExchBackups

The type of the file system is NTFS.
QuickFormatting 959M
Creating file system structures.
Format complete.
     960.0 MB total disk space.
     952.9 MB are available.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1000 total points
ID: 38336571
In fact using /Y you don't need to specify the volume name either:

format f: /q /fs:NTFS /Y /v:ExchBackups

Steve
0
 

Author Comment

by:maximus81
ID: 38336718
This worked. Thanks for the help

echo ExchBackups|format B: /FS:NTFS /Y /q /v:ExchBackups > C:\format.txt
0
 

Author Closing Comment

by:maximus81
ID: 38336721
Perfect. Thanks
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38336908
No problem. I don't think the /y is listed in the help but it does work :-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question