![]() |
|
|
|
#1 |
|
Guest
Posts: n/a
|
run bat file as a service in Windows 2003/XP
Hi,
Is it possible to run a bat file as a service? I created a service with the SRVANY and INSTSRV tools. I then created a bat file to check for the existence of a file in a certain folder and if it existed then delete that file. I then specified the path to the bat file in the new service's binpath. However when the service runs it doesn't delete the file. I can see the command prompt open up and close. When I directly run the bat file it deletes the file. But when the service runs it doesn't delete the file. I researched but couldn't find any specific answer. Thanks in advance Dan |
|
|
#2 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
I think the batch file doesn't work This post discussed the similar issue.
Run Application as a service"MSNewsGroup" <Cal> wrote in message news:%23y$JyPV1HHA.4980@TK2MSFTNGP03.phx.gbl... Is there a procedure to set an application to run as a service under ... http://www.chicagotech.net/netforums...pic.php?t=1192 Bob Lin, MS-MVP, MCSE & CNE Networking, Internet, Routing, VPN Troubleshooting on http://www.ChicagoTech.net How to Setup Windows, Network, VPN & Remote Access on http://www.HowToNetworking.com "Dan" <Dan@discussions.microsoft.com> wrote in message news:17576135-D132-44CB-84AB-C1898E872B7F@microsoft.com... Hi, Is it possible to run a bat file as a service? I created a service with the SRVANY and INSTSRV tools. I then created a bat file to check for the existence of a file in a certain folder and if it existed then delete that file. I then specified the path to the bat file in the new service's binpath. However when the service runs it doesn't delete the file. I can see the command prompt open up and close. When I directly run the bat file it deletes the file. But when the service runs it doesn't delete the file. I researched but couldn't find any specific answer. Thanks in advance Dan |
|
|
#3 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
I think the batch file doesn't work This post discussed the similar issue.
Run Application as a service"MSNewsGroup" <Cal> wrote in message news:%23y$JyPV1HHA.4980@TK2MSFTNGP03.phx.gbl... Is there a procedure to set an application to run as a service under ... http://www.chicagotech.net/netforums...pic.php?t=1192 Bob Lin, MS-MVP, MCSE & CNE Networking, Internet, Routing, VPN Troubleshooting on http://www.ChicagoTech.net How to Setup Windows, Network, VPN & Remote Access on http://www.HowToNetworking.com "Dan" <Dan@discussions.microsoft.com> wrote in message news:17576135-D132-44CB-84AB-C1898E872B7F@microsoft.com... Hi, Is it possible to run a bat file as a service? I created a service with the SRVANY and INSTSRV tools. I then created a bat file to check for the existence of a file in a certain folder and if it existed then delete that file. I then specified the path to the bat file in the new service's binpath. However when the service runs it doesn't delete the file. I can see the command prompt open up and close. When I directly run the bat file it deletes the file. But when the service runs it doesn't delete the file. I researched but couldn't find any specific answer. Thanks in advance Dan |
|
|
#4 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
Are you try to run it in an endless loop?
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Dan" wrote: > Hi, > > Is it possible to run a bat file as a service? I created a service with > the > SRVANY and INSTSRV tools. I then created a bat file to check for the > existence of a file in a certain folder and if it existed then delete that > file. I then specified the path to the bat file in the new service's > binpath. > However when the service runs it doesn't delete the file. I can see the > command prompt open up and close. > > When I directly run the bat file it deletes the file. But when the service > runs it doesn't delete the file. I researched but couldn't find any > specific > answer. > > Thanks in advance > Dan |
|
|
#5 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
Are you try to run it in an endless loop?
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Dan" wrote: > Hi, > > Is it possible to run a bat file as a service? I created a service with > the > SRVANY and INSTSRV tools. I then created a bat file to check for the > existence of a file in a certain folder and if it existed then delete that > file. I then specified the path to the bat file in the new service's > binpath. > However when the service runs it doesn't delete the file. I can see the > command prompt open up and close. > > When I directly run the bat file it deletes the file. But when the service > runs it doesn't delete the file. I researched but couldn't find any > specific > answer. > > Thanks in advance > Dan |
|
|
#6 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
...Thanks for responding..Yes I'm testing a scenario whereby the service would
continually monitor the folder and whenever a file appears it would delete it.. I'm not sure if this is the right way of doing it. The other option I have is to schedule a task for the bat file and make it run at regular intervals. Performance wise I'm not sure which is better. - Dan "Dave Patrick" wrote: > Are you try to run it in an endless loop? > > -- > > Regards, > > Dave Patrick ....Please no email replies - reply in newsgroup. > Microsoft Certified Professional > Microsoft MVP [Windows] > http://www.microsoft.com/protect > > "Dan" wrote: > > Hi, > > > > Is it possible to run a bat file as a service? I created a service with > > the > > SRVANY and INSTSRV tools. I then created a bat file to check for the > > existence of a file in a certain folder and if it existed then delete that > > file. I then specified the path to the bat file in the new service's > > binpath. > > However when the service runs it doesn't delete the file. I can see the > > command prompt open up and close. > > > > When I directly run the bat file it deletes the file. But when the service > > runs it doesn't delete the file. I researched but couldn't find any > > specific > > answer. > > > > Thanks in advance > > Dan > > |
|
|
#7 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
...Thanks for responding..Yes I'm testing a scenario whereby the service would
continually monitor the folder and whenever a file appears it would delete it.. I'm not sure if this is the right way of doing it. The other option I have is to schedule a task for the bat file and make it run at regular intervals. Performance wise I'm not sure which is better. - Dan "Dave Patrick" wrote: > Are you try to run it in an endless loop? > > -- > > Regards, > > Dave Patrick ....Please no email replies - reply in newsgroup. > Microsoft Certified Professional > Microsoft MVP [Windows] > http://www.microsoft.com/protect > > "Dan" wrote: > > Hi, > > > > Is it possible to run a bat file as a service? I created a service with > > the > > SRVANY and INSTSRV tools. I then created a bat file to check for the > > existence of a file in a certain folder and if it existed then delete that > > file. I then specified the path to the bat file in the new service's > > binpath. > > However when the service runs it doesn't delete the file. I can see the > > command prompt open up and close. > > > > When I directly run the bat file it deletes the file. But when the service > > runs it doesn't delete the file. I researched but couldn't find any > > specific > > answer. > > > > Thanks in advance > > Dan > > |
|
|
#8 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
I don't think that will work or yield desirable effects. Here are some more
elegant methods. http://www.codeproject.com/csharp/fi...ervicecsha.asp http://samples.gotdotnet.com/quickst...2fwatcher.aspx http://www.databasejournal.com/featu...le.php/3319261 -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Dan" wrote: > ..Thanks for responding..Yes I'm testing a scenario whereby the service > would > continually monitor the folder and whenever a file appears it would delete > it.. > > I'm not sure if this is the right way of doing it. The other option I have > is to schedule a task for the bat file and make it run at regular > intervals. > Performance wise I'm not sure which is better. > > - Dan |
|
|
#9 |
|
Guest
Posts: n/a
|
Re: run bat file as a service in Windows 2003/XP
I don't think that will work or yield desirable effects. Here are some more
elegant methods. http://www.codeproject.com/csharp/fi...ervicecsha.asp http://samples.gotdotnet.com/quickst...2fwatcher.aspx http://www.databasejournal.com/featu...le.php/3319261 -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Dan" wrote: > ..Thanks for responding..Yes I'm testing a scenario whereby the service > would > continually monitor the folder and whenever a file appears it would delete > it.. > > I'm not sure if this is the right way of doing it. The other option I have > is to schedule a task for the bat file and make it run at regular > intervals. > Performance wise I'm not sure which is better. > > - Dan |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Event ID 2003 after installing Windows Server 2003 Service Pack 2 | GregA415 | Windows Server 2003 | 6 | 28-08-2007 04:31 AM |
| Event ID 2003 after installing Windows Server 2003 Service Pack 2 | GregA415 | Windows Server 2003 | 0 | 28-08-2007 03:45 AM |
| Chkdsk on Windows 2003 Service Pack 1/Service Pack 2 | Sabo, Eric | Windows Server 2003 | 5 | 28-08-2007 03:16 AM |
| Chkdsk on Windows 2003 Service Pack 1/Service Pack 2 | Sabo, Eric | Windows Server 2003 | 1 | 28-08-2007 03:15 AM |
| Windows PE and Windows Server 2003 Service Pack 2 | SMS_Wannabe | Windows XP | 1 | 17-08-2007 08:39 AM |
< Home - Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |