Pregunta

If we would like to start some applications automatically we use to put them in start-up folder in windows environment, how to add/remove any application's EXE programmatically. i am using java for my application.

Detail With Background: Working on a desktop based application, and using Advanced Installer to create the installer for app, it is working fine, issue is we have an option to add/remove the short cut of app's EXE in order to start app on system start-up, The Advanced Installer gives option to add the EXE file into start-up but how to add/remove it using java, as its a java based application

I just need to get some idea about if i need to change some registry value or java file handling etc for doing this, Thanks in advance.

¿Fue útil?

Solución

If you use shortcuts in the Startup folder, then you can delete them by finding the reference to it via "%USERPROFILE%\Start Menu\Programs\Startup" then just do a File.delete(). You could write a *.bat file to do this for you too if it can't be done programaticaly in "Advanced Installer". If you want it to be a little more under-the-covers, the system also has startup items located in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Below is an example in regedit: enter image description here

Otros consejos

You can schedule task by executing next command:

schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc monthly /d 15 /ru "System"

You can execute this command by Runtime.getRuntime().exec()

If it is a Java application I assume you are using the java launcher from Advanced Installer? If so, all you need to do is to create a shortcut for your EXE launcher and place it in the predefined folder "Startup" folder under "Start Menu" folder from Files and Folders page. The shortcut will be installed there when you install the package and removed on uninstall, and it will start your application when the machine boots the OS.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top