Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: Help with Batch file, if statement in a specific time.

11 Nov 2010   #1

Windows 7 Ultimate x64
 
 
Help with Batch file, if statement in a specific time.

hi, I am working on a batch file, such as

[If Service A starts during 10pm-11pm, then stop Service A.]
If this is not possible, then just simply,
[If Service A starts, then stop Service A.]

Thanks!

My System SpecsSystem Spec
.

11 Nov 2010   #2

Windows 8 Core X64
 
 

Need a bit more information.

How is Service A being started?
Will the batch file be run manually or from a scheduled entry?

The simplest way to do this is to simply assume it's running and try to stop it.

net stop "Service A"

and not care if it gets an error or not. As I said, more info please.
My System SpecsSystem Spec
11 Nov 2010   #3

Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
 
 

I'm a little confused as well. A batch file is run at one time, or are you planning to have the batch file run in a constant loop?
My System SpecsSystem Spec
.


12 Nov 2010   #4

Windows 7 Ultimate x64
 
 

I am sorry for not providing enough infor.
here is my story..... I am running a backup Service. let say this service starts at 10PM, when it runs at 5%, another service A will begins, and I have to stop this service A right away, otherwise, my backup service will fail. However, every time while it runs at 5%, it uses a unique amount of time.
So how can I make this job complete?
note:Service A is set to manual, and I don't want to disable it, since some other program may use it in different time.
My System SpecsSystem Spec
12 Nov 2010   #5

Windows 8.1 Pro RTM x64
 
 

Do you need 'Service A' to run whilst you are running the backup Service? If not, create a batch file to disable it whilst you run the backup and then automatically reenable it when the backup is finished.

Can you post the contents of the batch file as you have it so far?
My System SpecsSystem Spec
12 Nov 2010   #6

Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
 
 

Agree with Dwarf. You should be able to disable, then re-enable a service from a batch file.
My System SpecsSystem Spec
12 Nov 2010   #7

Windows 8 Core X64
 
 

What software are you using for backup? Some allow you to run a command before and after the backup. You could then disable "Service A" at the start and enable it at the end.
My System SpecsSystem Spec
Reply

 Help with Batch file, if statement in a specific time.





Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:06 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33