Solved

Using a batch file to restart a service that has dependents.

Posted on 2015-02-11
1
78 Views
Last Modified: 2015-02-11
I am trying to restart a windows service using a batch file.  This windows service has two dependent services.  When I run the batch file manually it ask if i want to restart the dependents services by entering a (Y)es or (N)o.  When I set this up to run as a scheduled task it never completes because it is waiting for my input.  How to I write the batch file to enter in Y?
0
Comment
Question by:KineticNetworking
1 Comment
 
LVL 12

Accepted Solution

by:
Jeff Darling earned 500 total points
ID: 40604542
One possibility is to create a text file that contains a Y and a CRLF.

then, in the batch file, use redirection like this:

ERASE FOO\*.*  <YES.TXT

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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