Skip to main content

How to Restart the Print Spooler Service in Batch Script

The Print Spooler is the "Engine" of the Windows printing system. It manages the communication between your applications (like Word) and your printer hardware. Unfortunately, this service is notorious for hanging, crashing, or becoming "Stuck" when it encounters a corrupted print job or a driver conflict. When your printer simply stops responding, the most effective solution is to "Reboot" the system's printing logic. A Batch script can use the net stop and net start commands to forcefully restart the Spooler, clearing memory locks and re-initializing all printer connections in seconds.

This guide will explain how to perform a clean Spooler restart.

Method: The "Soft Restart" (Net commands)

This is the standard approach for resolving 90% of printing issues.

@echo off
echo [RECOVERY] Restarting Print Spooler service...

:: 1. Stop the service
echo [STEP 1] Stopping Print Spooler...
net stop spooler

if %errorlevel% neq 0 (
echo [WARNING] Spooler may already be stopped or failed to stop.
echo Attempting to start it anyway...
)

:: 2. Wait a few seconds for the process to fully exit
timeout /t 3 /nobreak >nul

:: 3. Start the service
echo [STEP 2] Starting Print Spooler...
net start spooler

if %errorlevel% equ 0 (
echo.
echo [SUCCESS] Spooler is now running. Try printing again.
) else (
echo.
echo [ERROR] Failed to start service. Possible causes:
echo - Script is not running as Administrator.
echo - A dependency service (RPC^) is not running.
echo - A corrupted printer driver is crashing the service.
)

pause
warning

Administrative Rights. Managing system-level services requires elevated privileges. You MUST run your script as an Administrator.

Method 2: The "Force Kill" (When 'net stop' Fails)

Sometimes the Spooler is so badly crashed that the net stop command hangs. In this case, you must "Terminate" the process.

@echo off
echo [CRITICAL] Killing frozen Spooler process...

:: First attempt a graceful stop with a timeout
net stop spooler >nul 2>&1

:: Taskkill forces the 'spoolsv.exe' process to close
:: /F = Force termination
:: /IM = Image name (process name)
taskkill /F /IM spoolsv.exe 2>nul

:: Brief pause to allow the process to fully exit
timeout /t 2 /nobreak >nul

:: Start it back up
net start spooler

if %errorlevel% equ 0 (
echo [OK] Spooler forced back online.
) else (
echo [ERROR] Spooler failed to restart after force kill.
echo Check Event Viewer for driver crash details.
)

pause

Method 3: Post-Update "Auto-Refresh"

Use this in a script that updates printer drivers to ensure the system recognizes the new driver files immediately.

@echo off
echo [LOG] Refreshing Print subsystem after driver update...

net stop spooler >nul 2>&1

if %errorlevel% neq 0 (
echo [WARNING] Could not stop spooler gracefully. >> driver_update.log
)

timeout /t 2 /nobreak >nul

net start spooler >nul 2>&1

if %errorlevel% equ 0 (
echo [DONE] Print subsystem refreshed. New drivers are active.
echo [%date% %time%] Spooler refreshed successfully. >> driver_update.log
) else (
echo [ERROR] Spooler failed to restart after driver update.
echo [%date% %time%] ERROR: Spooler restart failed. >> driver_update.log
)

How to Avoid Common Errors

Wrong Way: Restarting while someone is actively printing

If you restart the spooler while a large print job is halfway through its transmission to the printer, you may cause a permanent "Ghost job" that stays in the printer's own memory and results in corrupted pages.

Correct Way: Check the queue first. If the job count is 0, it is safe to restart. If it's not 0, warn the user that their current print job will be lost.

Problem: Service Dependencies

The Print Spooler relies on other services (like the RPC service).

Solution: If net start spooler keeps failing, check the status of the "Remote Procedure Call (RPC)" service. If RPC is off, the Spooler cannot start.

Best Practices and Rules

1. The "Clean Spool" Combo

For a truly "Deep Clean," combine this script with a command to delete the files in C:\Windows\System32\spool\PRINTERS. This ensures the spooler starts with a "Blank Slate." Always stop the spooler before deleting these files.

2. Identify Driver Crashes

If the Spooler crashes again minutes after you restart it, the problem is likely a Bad Driver. Check the Windows Event Viewer (eventvwr.msc) for "Spooler" errors to see which specific driver file is causing the crash.

3. Monitoring

You can set the Spooler service's "Recovery" options in Windows (under services.msc) to automatically restart, but a Batch script provides more control and visibility during manual troubleshooting sessions.

Conclusions

Restarting the Print Spooler service via Batch script is the "Golden Reset" for Windows hardware management. By moving beyond the wait-and-see approach and utilizing a direct service-level refresh, you regain control over your document flow. This professional reset capability is essential for system administrators and help-desk professionals who need to maintain 100% reliability in high-volume printing environments.