Home > OS >  How should I run a exe on startup when it has app files
How should I run a exe on startup when it has app files

Time:07-26

I made a windows forms app and exported it to a release folder.

I am trying to make it run on startup but the application needs to be in the same folder as it's application files.

I understand that you put it in shell:startup folder. But I cannot run just the exe because it depends on the other applications.

I asked this question earlier and got sarcastic responses and downvotes so can somebody at least explain why my question is bad OR give me a possible solution, thanks.

Is there a way that I can just run the application while keeping it in the folder. Or any other solutions?

CodePudding user response:

You don't need to put the whole app in the startup folder. You just need to put the shortcut of your application there. Here's a Windows 10 help topic: enter image description here

  • Edit the name of the shortcut or set an icon for it.
  • Rebuild all the projects (including the setup).
  • Install the setup (approve if requested to modify system)
  • if you sign out and sign in again, you will see the application is in startup folder.
  • To verify and see if the app is inside the folder:

    1. Press Win R keys to open Run window
    2. Type shell:startup and press Enter
    3. See the shortcut of your application in the startup folder.

    Example 2 - Put application is startup folder using code

    Follow these steps:

    1. Create Windows Forms Application

    2. Drop a CheckBox on the form and change its text to "Run at startup of Windows"

    3. Drop a Button on the form and change its text to "Save".

    4. Add a the following code to the project (Thanks to the enter image description here

    • Related