I have a bat file in which I have called a simple console application in c#. Whenever I run the bat file it displays the console and run. Can any one tell me how to run bat file as windows service so that to avoid this
Asked
Active
Viewed 1,237 times
0
-
Have you tried adding runas /user:domain\user "YourConsoleFilePathAndFileName" to the batch file? – David B Mar 10 '15 at 11:19
-
1Please prevent this from being an XY problem, where X is _"I want to do something"_ and Y is your perceived solution to problem X: _"So I need to run this batch file as a Windows Service"_. You don't want this. You can use SrvAny to create a Windows Service from any application, but you really don't want to. Explain us your original problem X. Probably you're looking for a Scheduled Task, for example. – CodeCaster Mar 10 '15 at 11:27
-
Hai CodeCaster. I want the bat file to run in background even though after signing out from the user account – wazza Mar 10 '15 at 11:33
1 Answers
0
I think this is what you're looking for:
Running a C# console application as a Windows service
It's not straightforward due to the fact that console app doesn't automatically qualify as a service, you will have to do some coding.
By the sound of your post though it seems as if you initially wanted to build a service in the first place, in that case, start from scratch and make a Windows service.