0

I have an application, in which we automatically start derby DB, spring boot web service and Java Fx application through and a python script. I created an exe which executes that python script and puts it in the startup folder. Is this correct method to start script automatically. Some antivirus detects my exe as harmful to this.

How do applications like Teamviewer and Utorrent automatically get started on pc start?

InteXX
  • 6,135
  • 6
  • 43
  • 80
kailashdesiti
  • 165
  • 1
  • 13

1 Answers1

0

You can use the Run or RunOnce registry keys:

Run and RunOnce registry keys cause programs to run each time that a user logs on. The data value for a key is a command line no longer than 260 characters. Register programs to run by adding entries of the form description-string=commandline. You can write multiple entries under a key. If more than one program is registered under any particular key, the order in which those programs run is indeterminate.

The Windows registry includes the following four keys:

  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

https://learn.microsoft.com/en-us/windows/win32/setupapi/run-and-runonce-registry-keys

Community
  • 1
  • 1
InteXX
  • 6,135
  • 6
  • 43
  • 80
  • I had read from a source that Microsoft doesn't support editing the registry keys. We should do it on our own risk. – kailashdesiti Oct 17 '19 at 12:22
  • @kailashdesiti ~ Consider the source. It sounds overly cautious from here. The level of risk, of course, depends on the key/value/data that you're editing. Consider this: have a look at the startup programs presently in one of the above Run keys on your compuer. You'll find entries along the lines of Norton Anti-Virus, RoboForm, HP Printer Manager, etc. These applications are all third-party to Microsoft, and the manufacturers are bringing in millions of dollars. If there truly were a danger here, they wouldn't be doing it. In fact, this is precisely what these Run keys are made for. – InteXX Oct 19 '19 at 09:17
  • @kailashdesiti ~ It's not clear what you mean by "Microsoft doesn't support editing the registry keys." Clearly they do support it, as Registry management has been part of both the WinAPI and the .NET Framework (which uses WinAPI under-the-covers for this) for many, many years now. You're limiting yourself for no good reason. – InteXX Oct 19 '19 at 09:32