Start an Indefinite Process on System Startup in Windows 7

0

I'm having a ton of trouble figuring this one out. I've written a listener program that just sits and waits for specific packets on a port on my system. I've tested it and know that it works so now I'm just trying to hook it up to starting when my system starts.

Naturally, I'd like for this to run indefinitely (or to have the process restart periodically). I'd also like it to run without having a user logged in.

I've tried using Task Scheduler and it does indeed start the task I've created upon startup without anyone logging in...but I get no response out of the program. Here's where I'm confused. In the log of the tasks it says the task finished after ~3 seconds. If I try to run the task manually, I get the same thing. The task finishes after only a couple of seconds. Shouldn't the task not end at all? My program runs until something manually kills it, so shouldn't the task not exit out until my program is done, or is it somehow forking the process? If it is, why don't I get any response out of it?

celestialorb

Posted 2014-12-21T05:43:09.840

Reputation: 121

Does the program rely on the path or other environment variables that might not be set when running as a task? – Paul – 2014-12-21T09:37:47.143

Probably your process needs administive rights and you didn't set [x] run with highest privileges in the task. – marsh-wiggle – 2014-12-21T12:25:27.617

I set it to run with the highest privileges when I created the service, so I don't think it's that. The command works when run from the Console, but not as a Service/Scheduled Task. In the output of tasklist the "Session Name" is "Services" when it doesn't work and "Console" when it does. Could this be affecting how it runs? The code doesn't rely upon any environment variables. – celestialorb – 2014-12-22T19:43:24.150

No answers