I created a Windows Service in C# that requires to get
passed command arguments like a Console App. I noticed
that there is an option "Start parameters" text box in
the property of a Windows Service in MMC. Is there any
way to get arguments using this option? If possible, what
framework method should I use to get an arguement?
Thanks in advance.
Eric 5 7129
Hi Eric,
You may try the Environment.GetCommandLineArgs Method.
Here is a helpful link.
Did I answer your question?
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> Subject: Get command arguments in Windows Service Date: Fri, 5 Sep 2003 11:14:28 -0700 Lines: 9 Message-ID: <22****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcNz2Yt3Dhmj8jm/RlO1ml5VJWd4bw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107449 NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible, what framework method should I use to get an arguement? Thanks in advance.
Eric
Thank you for your reply. However, your solution doesn't
work. I've already tried this. I think a Start parameter
of Windows Service doesn't pass any argument to
GetCommandLineArgs method.
Eric -----Original Message----- Hi Eric,
You may try the Environment.GetCommandLineArgs Method. Here is a helpful link. Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights.--------------------Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> Subject: Get command arguments in Windows Service Date: Fri, 5 Sep 2003 11:14:28 -0700 Lines: 9 Message-ID: <22****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcNz2Yt3Dhmj8jm/RlO1ml5VJWd4bw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.general:107449NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible,
whatframework method should I use to get an arguement? Thanks in advance.
Eric
.
Hi Eric,
Sorry for misunderstanding your quesiton.
Did you mean that you want to get the parameters in "Start parameters" text
box in
the property of a Windows Service in MMC in your services program?
If so, I think the args argument in the function
protected override void OnStart(string[] args)
is what you want.
Here is simple sample. You may have a check.
Windows Services: New Base Classes in .NET Make Writing a Windows Service
Easy http://msdn.microsoft.com/msdnmag/is...v/default.aspx
Did I misunderstand your question?
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> References: <22****************************@phx.gbl>
<Gx**************@cpmsftngxa06.phx.gbl>Subject: RE: Get command arguments in Windows Service Date: Mon, 8 Sep 2003 09:16:28 -0700 Lines: 56 Message-ID: <41****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN2JI7qoR2H+AzdR9ucVL9fs0/JAw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107680 NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you for your reply. However, your solution doesn't work. I've already tried this. I think a Start parameter of Windows Service doesn't pass any argument to GetCommandLineArgs method.
Eric
-----Original Message----- Hi Eric,
You may try the Environment.GetCommandLineArgs Method. Here is a helpful link. Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.--------------------Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> Subject: Get command arguments in Windows Service Date: Fri, 5 Sep 2003 11:14:28 -0700 Lines: 9 Message-ID: <22****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcNz2Yt3Dhmj8jm/RlO1ml5VJWd4bw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gblmicrosoft.public.dotnet.general:107449NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible,whatframework method should I use to get an arguement? Thanks in advance.
Eric
.
Thank you very much!!! It works.
Eric -----Original Message----- Hi Eric,
Sorry for misunderstanding your quesiton. Did you mean that you want to get the parameters
in "Start parameters" textbox in the property of a Windows Service in MMC in your services
program? If so, I think the args argument in the function protected override void OnStart(string[] args) is what you want.
Here is simple sample. You may have a check. Windows Services: New Base Classes in .NET Make Writing a
Windows ServiceEasy http://msdn.microsoft.com/msdnmag/is...12/NETServ/def
ault.aspx
Did I misunderstand your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights.--------------------Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> References: <22****************************@phx.gbl> <Gx**************@cpmsftngxa06.phx.gbl>Subject: RE: Get command arguments in Windows Service Date: Mon, 8 Sep 2003 09:16:28 -0700 Lines: 56 Message-ID: <41****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN2JI7qoR2H+AzdR9ucVL9fs0/JAw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.general:107680NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you for your reply. However, your solution doesn't work. I've already tried this. I think a Start parameter of Windows Service doesn't pass any argument to GetCommandLineArgs method.
Eric
-----Original Message----- Hi Eric,
You may try the Environment.GetCommandLineArgs Method. Here is a helpful link. Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.-------------------- Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> Subject: Get command arguments in Windows Service Date: Fri, 5 Sep 2003 11:14:28 -0700 Lines: 9 Message-ID: <22****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300Thread-Index: AcNz2Yt3Dhmj8jm/RlO1ml5VJWd4bw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107449NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible, whatframework method should I use to get an arguement? Thanks in advance.
Eric
.
.
Hi Eric,
Cool!
I am glad that it works for you.
Cheers!
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> References: <22****************************@phx.gbl>
<Gx**************@cpmsftngxa06.phx.gbl>
<41****************************@phx.gbl>
<og**************@cpmsftngxa06.phx.gbl>Subject: RE: Get command arguments in Windows Service Date: Tue, 9 Sep 2003 09:37:41 -0700 Lines: 120 Message-ID: <01****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN28K/Xk95AzBuTTU+pEbhRPyiRqQ== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107813 NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you very much!!! It works.
Eric
-----Original Message----- Hi Eric,
Sorry for misunderstanding your quesiton. Did you mean that you want to get the parameters in "Start parameters" textbox in the property of a Windows Service in MMC in your services program? If so, I think the args argument in the function protected override void OnStart(string[] args) is what you want.
Here is simple sample. You may have a check. Windows Services: New Base Classes in .NET Make Writing a
Windows ServiceEasy http://msdn.microsoft.com/msdnmag/is...12/NETServ/def ault.aspx
Did I misunderstand your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights.--------------------Content-Class: urn:content-classes:message From: "Eric Chong" <ec********@hotmail.com> Sender: "Eric Chong" <ec********@hotmail.com> References: <22****************************@phx.gbl> <Gx**************@cpmsftngxa06.phx.gbl>Subject: RE: Get command arguments in Windows Service Date: Mon, 8 Sep 2003 09:16:28 -0700 Lines: 56 Message-ID: <41****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN2JI7qoR2H+AzdR9ucVL9fs0/JAw== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gblmicrosoft.public.dotnet.general:107680NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you for your reply. However, your solution doesn't work. I've already tried this. I think a Start parameter of Windows Service doesn't pass any argument to GetCommandLineArgs method.
Eric
-----Original Message----- Hi Eric,
You may try the Environment.GetCommandLineArgs Method. Here is a helpful link. Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. -------------------- >Content-Class: urn:content-classes:message >From: "Eric Chong" <ec********@hotmail.com> >Sender: "Eric Chong" <ec********@hotmail.com> >Subject: Get command arguments in Windows Service >Date: Fri, 5 Sep 2003 11:14:28 -0700 >Lines: 9 >Message-ID: <22****************************@phx.gbl> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="iso-8859-1" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >X-MimeOLE: Produced By Microsoft MimeOLEV5.50.4910.0300>Thread-Index: AcNz2Yt3Dhmj8jm/RlO1ml5VJWd4bw== >Newsgroups: microsoft.public.dotnet.general >Path: cpmsftngxa06.phx.gbl >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107449 >NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163 >X-Tomcat-NG: microsoft.public.dotnet.general > >I created a Windows Service in C# that requires to get >passed command arguments like a Console App. I noticed >that there is an option "Start parameters" text box in >the property of a Windows Service in MMC. Is there any >way to get arguments using this option? If possible, what >framework method should I use to get an arguement? >Thanks in advance. > >Eric >
.
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: tuckkhai |
last post by:
Hi,
I am a newbie in this area. I would like to know whether is it possible to
execute shell command in windows service. I had install a program in the
server which i would like it to be executed...
|
by: Primo |
last post by:
Hi,
This problem has been frustrating me for days and I hope you experts can
help me out. I am trying to run a command, which I would normally run from
the command line, from within my C#...
|
by: BROQ |
last post by:
Hi,
I am using a windows service to extract every hour a log from our
mailserver in order to parse the logfile.
To do this I used the folowing code:
Shell("""C:\pscp"" -pw *******...
|
by: Eric Chong |
last post by:
I created a Windows Service in C# that requires to get
passed command arguments like a Console App. I noticed
that there is an option "Start parameters" text box in
the property of a Windows...
|
by: Fei |
last post by:
Hi,
I got a strange problem. I use Macrovision installshield x express
edition to build a simple MSI file. I can install this mis silently, i.e
using /qn. It has no problem to run either in the...
|
by: dmuralikumar |
last post by:
Hi All,
I am finding it difficult to send some parameters to the exe
corresponding to a Windows Service that has been installed.Its the same
case with the exe i.e., I dont where i have to make the...
|
by: Chris Mullins |
last post by:
For some reason the question, "Can I make an EXE that is both a Windows
Service and a Console Application?" has come up quite a bit for me over the
last few weeks.
I've been doing this for...
|
by: =?Utf-8?B?dmlzaHJ1dGg=?= |
last post by:
Hi,
I have 2 applications running, one Windows application project and the other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as...
|
by: =?Utf-8?B?dmlzaHJ1dGg=?= |
last post by:
Hi,
I have 2 applications running, one Windows application project and the other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |