-1

I'm working on a project and need guidance and examples(if possible). I have a console application that does not interact with the user. The console app reads an excel file and prints a value to a run-time created text file. I would like the console app to run when files in a directory are created or updated. My plan: My plan is to create a Windows Service that uses the FileSystemWatcher class to watch a directory and run the console app exe when the filesystemwatcher is notified of a change. Anyone have helpful links, advice, or examples I can use to complete the project. thanks!

1 Answers1

0

By default a windows service cannot interact with the UI, so you cannot start a visible console window. Since Vista there is an option to allow interaction with the UI (see "Allow Service to interact with desktop").

However, I think this question has already been answered in this thread.

aYo
  • 199
  • 1
  • 7
  • Your first sentence is confusing to me.. You can have a visible console window/app doing work without interacting with it. It'll just do its work and close when finished (unless you have code telling it to hold open/wait for input of some kind of course). I'm not sure what UI you think this service would need to be interacting with. – Broots Waymb Apr 08 '19 at 20:56
  • @BrootsWaymb: If I remember right you cannot start a visible console window by default, because it's still UI, even if it won't require any input. If you need a visible window, you will probably need to allow service to interact with desktop or have an application running which communicates with the service via named pipes or something. But I think that's a little bit off-topic as I don't think that the thread starter needs a visible window. I just wanted to mention it, just in case.. – aYo Apr 08 '19 at 21:59