Click to See Complete Forum and Search --> : How to Automate the FORMAT command??


Mark Moore
02-05-2002, 12:39 PM
Does anybody know how to Automate the FORMAT A: command to get the 'N' character
onto the command line after starting the command?

i.e.

#include <stdlib.h>
int main()
{

system("Format A:");// start format

// the command will request if you wish to format another disk Y/N
// What code do I add here???


return 0;

};


Thanks in Advance

jonnin
02-05-2002, 03:21 PM
create a text file with the offending "n" or "y" in it. call it y.txt or something.
then
create a batch file thusly

format a: << y.txt (this reads that char from file instead of from keyboard).

finally, edit the batch file (rt click) to "close on exit" or not
(yes, no extra clicks, no, see the error report for bad sectors)

optionally, do the close on exit and put a pause command in the batch file.


"Mark Moore" <aliasjones@mailexcite.com> wrote:
>
>Does anybody know how to Automate the FORMAT A: command to get the 'N' character
>onto the command line after starting the command?
>
>i.e.
>
>#include <stdlib.h>
>int main()
>{
>
>system("Format A:");// start format
>
>// the command will request if you wish to format another disk Y/N
>// What code do I add here???
>
>
>return 0;
>
>};
>
>
>Thanks in Advance

Mark Moore
02-05-2002, 03:34 PM
"jonnin" <jonnin@vol.com> wrote:
>
>create a text file with the offending "n" or "y" in it. call it y.txt or
something.
>then
>create a batch file thusly
>
>format a: << y.txt (this reads that char from file instead of from keyboard).
>
>finally, edit the batch file (rt click) to "close on exit" or not
>(yes, no extra clicks, no, see the error report for bad sectors)
>
>optionally, do the close on exit and put a pause command in the batch file.
>
>
>"Mark Moore" <aliasjones@mailexcite.com> wrote:
>>
>>Does anybody know how to Automate the FORMAT A: command to get the 'N'
character
>>onto the command line after starting the command?
>>
>>i.e.
>>
>>#include <stdlib.h>
>>int main()
>>{
>>
>>system("Format A:");// start format
>>
>>// the command will request if you wish to format another disk Y/N
>>// What code do I add here???
>>
>>
>>return 0;
>>
>>};
>>
>>
>>Thanks in Advance


Thanks for your reply but is there anyway to integrate all 3 files you describe
into one *.exe (executable) file?


Thanks in Advance

jonnin
02-05-2002, 05:20 PM
I guess.
Use system a lot.

int main()
{
system("echo n >> n.txt"); //if you create this once, its there.
system("format a: << n.txt");
system("pause"); //optional, if run from win double click, its needed
//to see input.
//you have to have the keyboard input in a file somewhere; its the
//way it works. You may be able to stick the 'n' on the keyboard stream
//somehow. Not going to figure out that for you, but I think you can do
//it...



}


"Mark Moore" <a1iasjones@mailexcite.com> wrote:
>
>"jonnin" <jonnin@vol.com> wrote:
>>
>>create a text file with the offending "n" or "y" in it. call it y.txt or
>something.
>>then
>>create a batch file thusly
>>
>>format a: << y.txt (this reads that char from file instead of from keyboard).
>>
>>finally, edit the batch file (rt click) to "close on exit" or not
>>(yes, no extra clicks, no, see the error report for bad sectors)
>>
>>optionally, do the close on exit and put a pause command in the batch file.
>>
>>
>>"Mark Moore" <aliasjones@mailexcite.com> wrote:
>>>
>>>Does anybody know how to Automate the FORMAT A: command to get the 'N'
>character
>>>onto the command line after starting the command?
>>>
>>>i.e.
>>>
>>>#include <stdlib.h>
>>>int main()
>>>{
>>>
>>>system("Format A:");// start format
>>>
>>>// the command will request if you wish to format another disk Y/N
>>>// What code do I add here???
>>>
>>>
>>>return 0;
>>>
>>>};
>>>
>>>
>>>Thanks in Advance
>
>
>Thanks for your reply but is there anyway to integrate all 3 files you describe
>into one *.exe (executable) file?
>
>
>Thanks in Advance
>

ralph
02-05-2002, 08:46 PM
"Mark Moore" <a1iasjones@mailexcite.com> wrote:
>
>"jonnin" <jonnin@vol.com> wrote:
>>
>>create a text file with the offending "n" or "y" in it. call it y.txt or
>something.
>>then
>>create a batch file thusly
>>
>>format a: << y.txt (this reads that char from file instead of from keyboard).
>>
>>finally, edit the batch file (rt click) to "close on exit" or not
>>(yes, no extra clicks, no, see the error report for bad sectors)
>>
>>optionally, do the close on exit and put a pause command in the batch file.
>>
>>
>>"Mark Moore" <aliasjones@mailexcite.com> wrote:
>>>
>>>Does anybody know how to Automate the FORMAT A: command to get the 'N'
>character
>>>onto the command line after starting the command?
>>>
>>>i.e.
>>>
>>>#include <stdlib.h>
>>>int main()
>>>{
>>>
>>>system("Format A:");// start format
>>>
>>>// the command will request if you wish to format another disk Y/N
>>>// What code do I add here???
>>>
>>>
>>>return 0;
>>>
>>>};
>>>
>>>
>>>Thanks in Advance
>
>
>Thanks for your reply but is there anyway to integrate all 3 files you describe
>into one *.exe (executable) file?
>
>
>Thanks in Advance
>

Depending on the version of command/cmd you can use the command separator:
"&&".

system("echo n >> n.txt && format a: << n.txt && pause");