1.

Solve : format a floppydisk without questions?

Answer»

I want to format a FLOPPY in a batch file without the usual input i have to give. I have done something like that for a hard drive which WORKS fine:

echo j | format c: /v:vollabel /q

the floppy however is asking me if i want to format another one and here the system halts.
here i need to press N. i dont have any idea how to add this N in my batch. I hope anyone out there can help me

thanks in advance
Code: [Select]echo yn|format a: /q >nul
works on English system
(>nul is to get rid of all the EXCESS prompt messages)

Mac
Thank you Mac
I COPIED your sugestion today in my batchfile but it didnt work. i took away the >nul option to see what happened and it looks the Jn characters are used right after "press enter when ready...." I hope there are some other options left

I dont know if it has anything to do with it but i am using a dos window in w98. i believe dos 7.xx. it could be the reason why it worked on your pc and not mine. i rather not go for the idea that it has something to do with language so i keep trying.





If you run the command manually
format c: /v:vollabel /q
exactly what keys to you have to press to get to the end?  Is it:
[Enter]
j [Enter]
n [Enter]

If so, you can save those KEYSTROKES to a temp file like this:
Code: [Select]echo.>fmt.tmp
echo j>fmt.tmp
echo n>fmt.tmp
format c: /v:vollabel /q<fmt.tmp
del fmt.tmp Quote

Code: [Select]echo.>fmt.tmp
echo j>fmt.tmp
echo n>fmt.tmp

Learn something every day! I always wanted to write blank lines with echo, but always got "echo is on/off".

You meant, of course, to use >> instead of > for the rest of the prompt file.

But you have to put "jn" together to avoid a line feed.

Code: [Select]echo.>fmt.tmp
echo jn>>fmt.tmp

Mac
Quote
I dont know if it has anything to do with it but i am using a dos window in w98. i believe dos 7.xx. it could be the reason why it worked on your pc and not mine.

I am embarrassed that the answer is that I goofed.

I didn't test with FORMAT, but tested with some commannd which has no such prompt for an enter-key. So I gave poor advice.

See GuruGary for the right idea (with my small correction).

So to attone for my sin, I just used the Bat file below to test on a floppy. First floppy I have formatted for at least 10 years: Don't use them much and if I ever buy any, they come pre-formatted.

It took about 2 minutes, seemed like 20. LOL.

Mac

Code: [Select]echo off
echo.>z.dat
echo yn>>z.dat
format a: >z.lst <z.dat

You can use "nul" rather than "z.lst" if you don't want to keep output.

Use any names you want for the files.
Good catch, Mac.  Yes, as corrected by QBasicMac, the code should be set to append the file.


Discussion

No Comment Found