Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file problems  (Read 4440 times)

0 Members and 1 Guest are viewing this topic.

Ike

  • Guest
Batch file problems
« on: August 15, 2004, 12:30:54 PM »
Hey everyone im new to this website so first of all Hey yall

but now comes my problem :(

Im writeing a batch file that will format all drives on any given pc. Problem is our teacher wants our batch to have no user interaction cept for typeing in format.bat in the command line. I got it down pretty much cept i cannot find a command to make it say Y when it goes to format  i need help i been messing with this for a day now and i dunno by brain is fried .
Thanks
Ike

2k dummy

  • Guest
Re: Batch file problems
« Reply #1 on: August 15, 2004, 01:04:48 PM »
I'm not buying into this, Ike. I think you are up some mischief in the computer lab. ;D

Silent_Kayos

  • Guest
Re: Batch file problems
« Reply #2 on: August 15, 2004, 01:52:53 PM »
Quote
Hey everyone im new to this website so first of all Hey yall

but now comes my problem :(

Im writeing a batch file that will format all drives on any given pc. Problem is our teacher wants our batch to have no user interaction cept for typeing in format.bat in the command line. I got it down pretty much cept i cannot find a command to make it say Y when it goes to format  i need help i been messing with this for a day now and i dunno by brain is fried .
Thanks
Ike



What do you got so far?

When I was doing this assignment I tried Format A: /y and it formatted the floppy. I have yet to try it on a hard drive, but it supposedly works that way.

The assignment sucks...

merlin_2

  • Guest
Re: Batch file problems
« Reply #3 on: August 15, 2004, 02:26:58 PM »
^ :)have a look at jimmy jims post i have replied to ^ ;D

Ike

  • Guest
Re: Batch file problems
« Reply #4 on: August 15, 2004, 07:38:33 PM »
Hmm that should work i think with the /y we will find out ima about run it soon as i get to school

and no im not up to michief in the pc lab :-P

MalikTous

  • Guest
Re: Batch file problems
« Reply #5 on: August 16, 2004, 06:38:36 PM »
You could build a variable (call it %d) that you make by constructing with a set of IF statements:

if exist c:\nul set %%d=c:
if exist d:\nul set %%d=%%d+ d:
if exist e:\nul set %%d=%%d+ e:
if exist f:\nul set %%d=%%d+ f:


Then issue the command:

format %%d /y

in your batch file.

Name the file form.bat to make DOS use it vice the same name as the DOS FORMAT command. To use, type FORM with the floppy in A: and selected as the current drive.
« Last Edit: August 16, 2004, 06:39:15 PM by MalikTous »