I have an exe and with java I need to make it starts at Windows Startup.I tried copying the exe in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp but I don't know if it is correct. What is the code to do that?
Asked
Active
Viewed 45 times
0
-
This is not a code related question and does not belong on StackOverflow. You're also looking to either create a "scheduled task" or to create a "windows service" which begins on system startup. Google either and you'll find plenty of resources telling you how to do so. – Jake Miller Apr 08 '18 at 16:53
-
Sorry, probably I was wrong to write the question : I'm asking Java code to do what I want – Gabriel Apr 08 '18 at 16:58
-
You don't need Java to make it run on Windows startup. You're trying to run an executable on Windows startup which is what Windows services or scheduled tasks are for. Use the Windows search tool to search for "scheduled tasks". Create a scheduled task with the option to "Run on startup" and have it point to your executable. – Jake Miller Apr 08 '18 at 16:59
-
I explain : I have a jar file, with a button I need to make an app starts at startup. It need to be automatic. – Gabriel Apr 08 '18 at 17:00
-
If you require a "button", then it's not automatic... A scheduled task will do exactly what you want. It'll start any application or executable at startup *automatically*. – Jake Miller Apr 08 '18 at 17:04
-
How can I make a scheduled task with a Java code? – Gabriel Apr 08 '18 at 17:08
-
You do **NOT** need Java code for this. Google "How to create a scheduled task on Windows" and you'll find a step by step guide on how to have Windows start your exe when the computer is started up. You tried dragging the executable into `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp` because you wanted the .exe to run whenever the computer is turned on, right? A scheduled task will do exactly this for you. – Jake Miller Apr 08 '18 at 17:16
-
To copy my file in that directory I need administrator priviledges? And Program Data folder is hide, can I copy my file in that folder? – Gabriel Apr 08 '18 at 17:18
-
You aren't understanding what I'm saying. Follow this tutorial: https://windowsreport.com/schedule-tasks-windows-10/ – Jake Miller Apr 08 '18 at 17:19
-
I solved, I only start a bat file with java. The bat file contain code explained in [this question](https://stackoverflow.com/questions/3582108/create-windows-service-from-executable) and I only added the automatically start parameter. Thanks anyway @JakeMiller! – Gabriel Apr 08 '18 at 18:10