471,337 Members | 859 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Running a service from the cmd prompt.

UJ
I thought I saw somewhere that you could run a service from the cmd prompt
and then any Console.Write you did would go to the screen.

Is that true?

TIA - Jeff.
Feb 17 '06 #1
6 1476
It is in unmanaged C/C++, but I don't think you can do it using .net.

Feb 17 '06 #2
Hi,

Hi,

You can use NET START "service name" to strt the service, not sure (don't
think so) that you can see the output to the console.
note that the service should be installed.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"UJ" <fr**@nowhere.com> wrote in message
news:e3*************@TK2MSFTNGP15.phx.gbl...
I thought I saw somewhere that you could run a service from the cmd prompt
and then any Console.Write you did would go to the screen.

Is that true?

TIA - Jeff.

Feb 22 '06 #3
"net start" is used to start a service, what the OP is looking for is to
start a 'service' as a Console program which is not possible unless you
modify the service such that it can run as both, for instance by passing a
command line argument that tells the process to run as a Console program.
Willy.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ev**************@TK2MSFTNGP11.phx.gbl...
| Hi,
|
| Hi,
|
| You can use NET START "service name" to strt the service, not sure
(don't
| think so) that you can see the output to the console.
| note that the service should be installed.
|
|
| --
| Ignacio Machin,
| ignacio.machin AT dot.state.fl.us
| Florida Department Of Transportation
|
| "UJ" <fr**@nowhere.com> wrote in message
| news:e3*************@TK2MSFTNGP15.phx.gbl...
| >I thought I saw somewhere that you could run a service from the cmd
prompt
| >and then any Console.Write you did would go to the screen.
| >
| > Is that true?
| >
| > TIA - Jeff.
| >
| >
|
|
Feb 22 '06 #4
Can that be done anymore, I haven't worked too much with services in
..net, but the ones I have worked on seemed to have had allot done to
them by the ide to prevent this?

Feb 23 '06 #5

"william_dudek@_yahoo_com" <wi***********@yahoo.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
| Can that be done anymore, I haven't worked too much with services in
| .net, but the ones I have worked on seemed to have had allot done to
| them by the ide to prevent this?
|

Sure it can be done, but you need to change your code such that it follows a
different path when you start it from the command prompt. Remember that
Services are started by the SCM, which establishes a named pipe connection
through witch it communicates with the service, this named pipe channels is
used by the SCM to send commands like Start, Stop, Pause etc... to the
service, the Service itself uses the same pipe to report the status or
status changes back to the SCM. So this whole thing has to be skipped when
launching from the command line, not a trivial thing to do but not
impossible too.

Willy.

Feb 23 '06 #6
Thanks, that's how I rememeber them working before .net, I thought it
was odd that they couldn't work that way any more. Do you (or anyone)
know of any books or websites on the subject, I have been working with
services for years, but don't know the details of how they work behind
the scenes.

Feb 23 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Bill Hauver | last post: by
8 posts views Thread by Russ Green | last post: by
7 posts views Thread by scarred wind | last post: by
5 posts views Thread by SiD` | last post: by
13 posts views Thread by dancer | last post: by
terryble
reply views Thread by terryble | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.