PC Review


Reply
Thread Tools Rate Thread

determine if Windows Service executable run from command line?

 
 
Dan Schullman
Guest
Posts: n/a
 
      4th Oct 2003
Hello,

I'm trying to write an executable that is both a Windows Service and a
utility for managing that service from the command line. The question is,
how can I determine if 'main' in my J# (or C#) code is being called by the
service manager or from the command line?

Currently I'm differentiating these two cases by requiring the CLI usage to
specify some arguments, as I have yet to see 'main' (vs. 'OnStart') receive
any arguments from the service manager. However, I would like to be able to
specify no arguments from the CLI as well and yet still detect this as CLI
usage. Is there some class method I can call to differentiate these two
scenarios?

By the way, I also noticed that contrary to the docs for ServiceBase.Run(),
it does NOT throw an exception when invoked from a command line program but
rather pops up a GUI error message and then simply returns, so the caller
presumably has no way to know that it failed.

Thanks!
Dan S.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting Command Line Executable randyelliott@earthlink.net Windows XP Customization 3 11th Jul 2005 06:36 PM
Limiting Command Line Executable randyelliott@earthlink.net Windows XP Security 3 11th Jul 2005 06:36 PM
Run an executable remotely via command line Chris Microsoft Windows 2000 Developer 1 25th Oct 2003 07:46 PM
determine if executable being run by Service Control Manager Dan Schullman Microsoft Dot NET Framework 7 21st Oct 2003 09:00 PM
Where is the New Service Executable Command Line? Joseph Microsoft Windows 2000 CMD Promt 1 1st Oct 2003 03:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:53 PM.