Q. How can I launch an application that requires a user session to launch when my OS starts?
One easy way to auto launch an application that requires a user session at system startup.
July 14, 2015
Q. How can I launch an application that requires a user session to launch when my OS starts?
A. To enable automatic logon set the AutoAdminLogon:
Open the registry editor (regedit.exe)
Move to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon
Create (String value) or modify AutoAdminLogon and set to 1
Create/set (string value) DefaultUsername and DefaultPassword to the required credentials
You likely already have some batch file/script to launch your application. Just drag a shortcut to this in the startup folder. The startup folder can be opened by running shell:Startup. There are other methods such as the users Run key (HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun), scheduled task etc but the startup folder is the easiest. Note a good option as part of this batch file is to lock the machine so your console is not exposed. Just add the following to your batch file:
::Lock the machinerundll32.exe user32.dll,LockWorkStation
For example to launch my minecraft start batch then lock I use:
::Launch the batch filestart minecraft.bat::Lock the machinerundll32.exe user32.dll,LockWorkStation
Now when the OS starts the user will automatically be logged on and the application started.
Another option is to convert the application to a service. There are numerous tools available which make an application a service by creating a wrapper around it. For Java applications (like Minecraft server) a good option is http://sourceforge.net/projects/yajsw/.
(This started because of a need to automatically start my Minecraft server when I start the VM it runs on in Azure (I am using Azure Automation to stop/start the server at certain times so didn't want user action to be required). The Minecraft server runs as an application in the users session rather than as a true service. The solution was actually very simple, using very old school techniques, and would apply to any application.)
About the Author
You May Also Like