Please avoid top posting on this list. Just answer inline.
Disclaimer: I don't use Windows, and prunsrv.exe.
I have acces to a Windows 10 machine, 64 bit, where I just installed Zulu JDK 17 64 bit: [1],
and downloaded Gerrit from this CI-job: [2]. Then I downloaded prunsrv from here: [3].
First of all you need to setup gerrit site, using
$> java -jar gerrit.war init -d <path-to-gerrit-site>
Also verify, that you can start gerrit daemon before even trying to install Windows service:
$> java -jar gerrit.war daemon -d <path-to-gerrit-site>
Then I used this command (cmd.exe should be opened with admin ACL):
$> D:\pgm\prunsrv.exe install gerrit ^
--DisplayName "Gerrit" --Classpath "D:\pgm\gerrit_site\bin\gerrit.war" --StopClass "com.google.gerrit.launcher.GerritLauncher" ^
--StopMethod "daemonStop" --StopMode "jvm" --StartPath "D:\pgm\gerrit_site" --StartClass "com.google.gerrit.launcher.GerritLauncher" ^
--StartParams "-d;D:\pgm\gerrit_site" --StartMethod "daemonStart" --StartMode "jvm" --LogPath "D:\pgm\gerrit_site\logs" --LogLevel "Debug"
Now, I was able to use both, start gerrit in the console:
$> D:\pgm\prunsrv.exe run gerrit
and start gerrit as a service:
$> D:\pgm\prunsrv.exe start gerrit
You can also check commons-daemon-log and also error_log files located in gerrit site
directory. Another option is to check Windows Event Viewer for related error messages.