Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Files, Restart Service

Status
Not open for further replies.

XMSMS

ISP
Oct 27, 2003
9
GB
Hello,

I am working on a script that will do the following:

Compare file1 and file2. If file1 is larger than file2, then restart a service.

I am a bit of a newbie, so please be gentle with me!!
 
To compare the size of 2 files:
Code:
Set fso=CreateObject("Scripting.FileSystemObject")
Set f1=fso.GetFile("\path\to\file1")
Set f2=fso.GetFile("\path\to\file2")
If f1.size > f2.size Then ...

Hope This Help
PH.
 
Thanks for the code to compare the files.

I do have some code that will start or stop a service, but i am entering some problems..

If i get my script to stop the service, before the service has finished stopping it attempts to start it again, and fails. Any ideas?

Thanks
 
You can play with the WScript.Sleep method:
Code:
WScript.Sleep 1000 'Suspend this script for 1 second

Hope This Help
PH.
 
Thanks for that.

Do you know how to kill a windows process by its name (rather than pid)?

I have a service that has problems stopping occasionaly, and requires the process to be killed before the service can successfully be started again.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top