-
Notifications
You must be signed in to change notification settings - Fork 276
Windows Service
Tres Finocchiaro edited this page Nov 18, 2019
·
35 revisions
- ✅ 2.1 | ✅ 2.0 | ✅ 1.9 | ...
- Run QZ Tray as a Windows service
- NSSM Service Manager: https://nssm.cc/download (Prerelease version is required)
- Warning: Services can't show the "Trusted" dialog! First, whitelist the website with the certificate to be "trusted" by visiting this site and clicking "Remember this decision".
- Open a command prompt As Administrator
- Create a
.bat
file that can launch QZ Trayecho java -Xms512M -jar "%~dp0\qz-tray.jar" %* > "%PROGRAMFILES%\QZ Tray\qz-tray.bat"
- Make a location for SYSTEM certificate whitelist
mkdir "%WINDIR%\System32\config\systemprofile\AppData\Roaming\qz"
- Copy the
allowed.dat
to the SYSTEM profilecopy /Y "%APPDATA%\qz\allowed.dat" "%WINDIR%\System32\config\systemprofile\AppData\Roaming\qz\allowed.dat"
- Open a command prompt As Administrator
- If not already, extract NSSM to
C:\
(e.g.C:\nssm
) - Change to the
win64
directory within NSSM.cd C:\nssm\win64
- Install the
QZ Tray
servicenssm install "QZ Tray" "%PROGRAMFILES%\QZ Tray\qz-tray.bat" nssm set "QZ Tray" Description "Browser printing utility"
- Start the service
net start "QZ Tray"
- Run QZ Tray with a custom Java version (Important: change
c:\Program Files\Java\jdk1.8.0_231\bin
to point to a proper JDK)echo PATH=%PATH%;c:\Program Files\Java\jdk1.8.0_231\bin > "%PROGRAMFILES%\QZ Tray\qz-tray.bat" echo java -Xms512M -jar "%~dp0\qz-tray.jar" %* >> "%PROGRAMFILES%\QZ Tray\qz-tray.bat"
- Open a command prompt As Administrator
- Change to the
win64
directory within NSSM.cd C:\nssm\win64
- Uninstall the
QZ Tray
servicenet stop "QZ Tray" nssm remove "QZ Tray"