下面的代码在 Java 中用于创建 Windows 服务。
当我使用 jar 运行批处理文件时,它的安装服务作为系统。谁能帮助如何以当前用户身份安装该服务?
用户 = “xyz”
是否需要 Windows 登录密码?
process = Runtime.getRuntime().exec(new String[] { installFolder+"/UninstallerAgent.exe",
"//IS//UninstallerAgent",
"--Install=" + installFolder + "/Uninstaller.exe",
"--DisplayName=UninstallerAgentv1.1",
"--Jvm=" + installFolder + "/runtime/bin/j9vm/jvm.dll",
"--Classpath=" + installFolder + "/UninstallerAgent.jar",
"--Startup=auto",
"--StartMode=jvm",
"--StartClass=com.uninstaller.Main",
"--StartMethod=\"start\"",
"--StartParams=\"start\"",
"--StopMode=jvm",
"--StopClass=com.uninstaller.Main",
"--StopMethod=\"stop\"",
"--StopParams=\"stop\"",
"--LogLevel=Error",
"--LogJniMessages=0",
"--LogPath="+installFolder,
"--LogPrefix=\"UninstallerAgentService\"",
"--StdOutput=auto",
"--StdError=auto",
"--Description=\"Local Probe for finding IP and Serial ID\""
});