Reputation: 167
I want to execute "start [Filename].txt" at fixed interval. So I decide to create windows service. But I am not getting idea to execute this command through windows service. Other logic i have implemented. Just remaining is execute command.
Upvotes: 1
Views: 4621
Reputation: 12119
Create a PowerShell script and have it executed on schedule by task scheduler...
Upvotes: 2
Reputation: 3717
Process.Start will not accomplish your likely goal if in a Windows Service. It may launch the process....into session 0, so you will never see it. To launch a process from a service that the user can interact with, you will need to create the process in the user session, a pretty non-trivial thing to do from inside a windows service (but certainly possible). You might be best to look at a Windows Scheduled Task as @jglouie suggested.
Upvotes: 0
Reputation: 12880
Process.Start("filename.txt")
will work as @Marco answered
I'm wondering if you could get away with a Windows Scheduled Task instead of a service.
Is that all your service does?
Upvotes: 2
Reputation: 57573
I think you can simply use:
Process.Start("filename.txt");
If you need to start that file and wait for it to close or some other particular action, take a look at Process Class.
Upvotes: 4