Windows starts the self-starting jar package

1. Create a new txt text document

2. Copy the following content, and remember to modify appName to the directory where your jar package is located and modify the jar package name

3. Rename the text document .txt to (name yourself) .bat     (Note: change to .bat file , name it yourself)

@echo off
setlocal
 
set appName=D:/test/customer-server-0.0.2-SNAPSHOT.jar
set appProfile=dev
 
echo "Start %appName% ..."
start javaw -jar %appName% --spring.profiles.active=%appProfile%
 
endlocal
exit

 4. Drag and drop the new text document.bat file to the startup directory

 

C:\Users\zzn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Or find your own Startup folder and put it in.

Whether the test was successful:

1. (First make sure that your file is already in the startup directory) Double-click the new text document.bat file directly, the window that flashes past, and the task manager, javaw.exe is displayed in the process, indicating that it is successful, no need to restart the test , the next boot automatically starts.

Guess you like

Origin blog.csdn.net/qq_42315633/article/details/130153808