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 8099791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:31:39+00:00 2026-06-05T22:31:39+00:00

I want that my application (a WPF Window ) is launched on Windows startup.

  • 0

I want that my application (a WPF Window) is launched on Windows startup. I tried different solutions, but no one seems to work. What i have to write in my code to do this?

  • 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. Editorial Team
    Editorial Team
    2026-06-05T22:31:41+00:00Added an answer on June 5, 2026 at 10:31 pm

    You are correct when you say that you must add a key to the registry.

    Add a key to:

    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    

    if you want to start the application for the current user.

    Or:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 
    

    If you want to start it for all users.

    For example, starting the application for the current user:

    var path = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
    RegistryKey key = Registry.CurrentUser.OpenSubKey(path, true);
    key.SetValue("MyApplication", Application.ExecutablePath.ToString());
    

    Just replace the line second line with

    RegistryKey key = Registry.LocalMachine.OpenSubKey(path, true);
    

    if you want to automatically start the application for all users on Windows startup.

    Just remove the registry value if you no longer want to start the application automatically.

    As such:

    var path = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
    RegistryKey key = Registry.CurrentUser.OpenSubKey(path, true);
    key.DeleteValue("MyApplication", false);
    

    This sample code was tested for a WinForms app. If you need to determine the path to the executable for a WPF app, then give the following a try.

    string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
    

    Just replace “Application.ExecutablePath.ToString()” with the path to your executable.

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

Sidebar

Related Questions

i'm developing an application (wpf) that have 3 windows. in the main window user
My WPF application has more than one window, I want to attach some of
I have a WPF application that I want to deploy to client PCs via
I want my WPF application to have a ToggleButton that contains an image of
I have a WPF application that contains some Window s with few UserControl s
In my application i have a WPF Window that has a DataGrid in it.
I have a Window that serves as a dialog in a WPF application. This
In my WPF-application, I want that the user can change the background color like
I wrote some wpf application that contain labels. I want to change the label
I have a simple WPF window that has 12 buttons on it. I want

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.