Link to home
Start Free TrialLog in
Avatar of a222493
a222493

asked on

Provide a "Y" answer to a batch file

Hi,

I have the following batch script called dropShares.bat:

net share sharename1 /delete
net share sharename2 /delete
net share sharename3 /delete
net share sharename4 /delete

The "net share" command will sometimes prompt me for a response, thus stopping the batch script.  How can I suppress this behavior, or provide several "Y" values?

Avatar of softplus
softplus

echo y | net share sharename1 /delete
:)
Avatar of a222493

ASKER

I type:

echo y | net share applications /delete

and I receive the error:
No valid response was provided.


Am I missing something???

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a222493

ASKER

Wow,  You've gotta be kidding me.  I never even tried it because I thought it would be documented....

Thanks
can you try it without the spaces around the pipe-symbol (|):
   echo y|net share applications /delete

I tried it with something else (echo y | del \temp\*.*) and it worked.. What question is it asking?
good one sirbounty :)
It's the little things, eh?
Happy to have helped. 8-)