windows service to call batch file
I need to create a service that will call a batch file. Here's the catch though - once the service calls the batch file, the command window that the batch file runs in must be visible on the desktop, it cannot run hidden. So far nothing I've tried results in the command window being visible. Any suggestions?
Related Article: running a batch file
is a C# discussion thread by witchDoc that has 2 replies, was last updated 1 year ago and has been tagged with the keywords: c#.
spowel4
Junior Poster in Training
57 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Does it really need to be a windows service?
Could it just be a windowless app that has an internal timer that fires and spawns the batch file?
You could launch it from the startup folder or from the registry.
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
It just needs to run any time the server reboots or powers up after a shutdown, and it needs to run whether a user is logged on or not. I thought of a service because a service can be set to run automatically. Would the registry approach solve that aspect of the problem?
spowel4
Junior Poster in Training
57 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
It would not run unless a user is logged in.
You could also use the Windows Scheduler. It does not require a user to be logged in, but you would need to put an entry for every time of day you would want it to run.
I can't remember though, if it would pop-up a window if the user is logged-in.
One way to find out... :)
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7