Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:14:09+00:00 2026-05-11T01:14:09+00:00

I have a Deplhi based Windows Service that, on installation, parses some command line

  • 0

I have a Deplhi based Windows Service that, on installation, parses some command line arguments. I want those arguments to be added to the services command line (ImagePath value on the registry) so that the service is always started with them.

How can I accomplish this?

I want the regedit look like this:
at registry key HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MyService

  • ImagePath = C:\Path\to\my\service.exe -some -arguments

Thanks

Update: The installation is done with >MyService.exe /install -some -arguments. Those arguments are the ones I want to persist in the command line.

Update: I found a solution by writing directly to the registry (see here), but I’d still like a more elegant solution, like using some TService property or something of that sort. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:14:09+00:00Added an answer on May 11, 2026 at 1:14 am

    Ok, after some research, I gave up on an elegant approach, and took the straight-forward path of writing directly to the registry.

    To make things simple, I did this: I store the arguments I wanted to pass in variables on my TService. Then, I set the AfterInstall event to write directly into the registry (using a TRegistry object) the exact command line I wanted.

    uses Registry; procedure MyService.AfterInstall(Sender: TObject) ; var   reg:TRegistry; begin   reg := TRegistry.Create;   try     reg.RootKey := 'HKEY_LOCAL_MACHINE';     if reg.OpenKey('SYSTEM\CurrentControlSet\Services\MyService', True) then     begin       reg.WriteExtendString ('ImagePath', ParamStr(0) + ' -some -arguments') ;       reg.CloseKey;     end;   finally     reg.Free;   end; end; 

    Not the elegant solution I was looking for, but it does the job.

    Thanks for the other answers through!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several Delphi programs that maintain connections to a database (some Oracle, some
I have a Delphi XE2 Firemonkey application that I want to run on both
I have a .Net WCF client/proxy built based on a Delphi service. The Delphi
Brief I have an installation package (MSI based) which attempts to register a dll
I have a Delphi 6 application that uses the Indy 9 components to maintain
I have a Delphi application that has a document browser as the main form.
I have a Delphi 2009 application that runs a query over a database using
After many cases of trial and error, I have concluded that the only solution
I have a Delphi 6 application that is heavily multithreaded. I have a component
I have a native Delphi TFrame that emulates Roy Tanck's Cumulus Tag Cloud viewer,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.