?
Solved

How to code in auto "yes" response in .bat script.

Posted on 2012-09-13
5
Medium Priority
?
2,038 Views
Last Modified: 2012-09-20
Hello-

I am writing a basic windows .bat file to stop a network share. It is asking for a y/n and enter input before it can stop the share.

e.g net share folder \\server /delete

How do i code in the "yes" to automatically complete my program without manual input.

Note: The script will be a scheduled task, so it needs to auto run without manual input.
0
Comment
Question by:StewartTechnologies
5 Comments
 
LVL 22

Assisted Solution

by:Christopher McKay
Christopher McKay earned 100 total points
ID: 38396882
You could try using an echo command to pipe to the net share command. Have you tried this:

echo y | net share folder \\server /delete


Hope this helps!

:o)

Bartender_1
0
 
LVL 85

Assisted Solution

by:oBdA
oBdA earned 100 total points
ID: 38396887
Just add "/y" to your command line:n
et share "SomeShare" /delete /y

Open in new window

0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 100 total points
ID: 38396888
Hi, I don't get the y/n question, but you can try adding /yes like this:

net share folder \\server /delete /yes

Or try this:

echo y | net share folder \\server /delete
0
 
LVL 6

Accepted Solution

by:
Manuel Marienne-Duchêne earned 100 total points
ID: 38396896
0
 

Author Closing Comment

by:StewartTechnologies
ID: 38418812
Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question