[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


how do I get format to work from the commandline with no prompts?

Posted on 2005-04-25
Medium Priority
Last Modified: 2010-04-14
Hey guys,
I have written a batch for 2k3 which shutdowns certain services, runs defrag, and then restarts the services once a day. I am trying to accomplish this same thing with 2000. I have run into a variety of problems. First being that defrag is not supported from the commandline in 2k. No biggie. The work around is to simply quick format the raid device (mail spool) however, I cannot seem to get format to go from the batch file without prompting for the volume label and then a yes no answer. How do I accomplish this?

Worth 500 points.

Question by:richardsimnett
LVL 57

Expert Comment

by:Pete Long
ID: 13857137
Hi richardsimnett,
format /q

not work?

LVL 85

Accepted Solution

oBdA earned 1000 total points
ID: 13857245
The volume label can be specified with the /v:VolumeLabel switch; as for the prompt, try to pipe an "echo." to the format command. Specify the file system with /fs:NTFS. So the following line should do what you need:
echo.|format X: /v:VolumeLabel /fs:NTFS /q
On the other hand: a simple
rd /s /q "X:\Mail\Spool\Folder"
should work as well, shouldn't it?
LVL 12

Assisted Solution

Carlo-Giuliani earned 1000 total points
ID: 13859044
Hmm....trickier that is sounds at first.  oBdA's suggestion will *almost* work, but
- you have to specify ECHO Y (not ECHO .)
- The volume label must be blank, to avoid having to specify the "old" volume label

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

LVL 85

Expert Comment

ID: 13859130
Well, I could only test it with a floppy (on which it worked), I didn't have a spare partition ...
LVL 12

Expert Comment

ID: 13859935
yeah, it will work when formatting a new partition...but then if you run it a second time it expects you to also enter the "old" label for verification (unless it is blan).
LVL 32

Expert Comment

ID: 13862276
A workaround might be to just delete all files and folders on that drive with a command like:

 del z:\*.* /f/s/q

LVL 12

Expert Comment

ID: 13862796
Yes, deleting all the files sounds like a good alternative.

Author Comment

ID: 13863276
Ok... I have done the following which works:

ECHO Y | format f: /Q
md f:\spool

Just deleting the files and directories wont do it, as it doesnt realign the filesystem. (Ideally I would be able to defrag the raid from the command prompt, but thats not an option in win2k). After a few days of running the raid (SCSI 320) performance drops significantly because of the fragmentation of the file system.


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 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