java-bat文件以管理员权限启动jar包

@echo off

:: BatchGotAdmin (Run as Admin code starts)

REM --> Check for permissions

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.

if '%errorlevel%' NEQ '0' (

echo Requesting administrative privileges...

goto UACPrompt

) else ( goto gotAdmin )

:UACPrompt

echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"

echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"

exit /B

:gotAdmin

if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )

pushd "%CD%"

CD /D "%~dp0"

:: BatchGotAdmin (Run as Admin code ends)

:: Your codes should start from the following line

java -jar F:\gitwg\like-wg\out\artifacts\wg_jar\wg.jar -Xmx1024m -Xms1024m

只需要改最后一行即可

你可能感兴趣的:(java,java,jar,开发语言)