• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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

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.

Thanks,
Rick
0
richardsimnett
Asked:
richardsimnett
2 Solutions
 
Pete LongTechnical ConsultantCommented:
Hi richardsimnett,
format /q

not work?

PeteL
0
 
oBdACommented:
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?
0
 
Carlo-GiulianiCommented:
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



0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
oBdACommented:
Well, I could only test it with a floppy (on which it worked), I didn't have a spare partition ...
0
 
Carlo-GiulianiCommented:
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).
0
 
r-kCommented:
A workaround might be to just delete all files and folders on that drive with a command like:

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

0
 
Carlo-GiulianiCommented:
Yes, deleting all the files sounds like a good alternative.
0
 
richardsimnettAuthor Commented:
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.

Thanks,
Rick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now