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?

a222493Asked:
Who is Participating?
 
sirbountyConnect With a Mentor Commented:
try net share applications /delete /y
0
 
softplusCommented:
echo y | net share sharename1 /delete
:)
0
 
a222493Author Commented:
I type:

echo y | net share applications /delete

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


Am I missing something???

0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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

Thanks
0
 
softplusCommented:
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?
0
 
softplusCommented:
good one sirbounty :)
0
 
sirbountyCommented:
It's the little things, eh?
Happy to have helped. 8-)
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.

All Courses

From novice to tech pro — start learning today.