How to Rename a Printer in Batch Script
Naming conventions are the backbone of a well-organized network. When you first install a printer, it often gets a cryptic name like "HPLJPRT001" or "USB002." As your office grows, you need clear, location-based names like "Accounting-Color" or "Warehouse-Labeler" to ensure users can find the right device. Rather than right-clicking every printer icon and typing a new name, a Batch script can use WMIC or PowerShell to programmatically rename your printers. This allows you to standardize your entire office's printer list in a single click, eliminating confusion and reducing "Sent to the wrong floor" errors.
This guide will explain how to rename local and network printers.
Method 1: The Standard Rename (PowerShell)
PowerShell's Rename-Printer cmdlet is the most reliable way to change a printer's friendly name on modern Windows systems.
@echo off
set "OldName=HP_LaserJet_1020"
set "NewName=Reception_Printer"
echo [ACTION] Renaming "%OldName%" to "%NewName%"...
:: Verify the source printer exists
powershell -NoProfile -Command ^
"$p = Get-Printer -Name '%OldName%' -ErrorAction SilentlyContinue;" ^
"if (-not $p) { Write-Host '[ERROR] Printer not found: %OldName%'; exit 1 };" ^
"$existing = Get-Printer -Name '%NewName%' -ErrorAction SilentlyContinue;" ^
"if ($existing) { Write-Host '[ERROR] A printer named %NewName% already exists.'; exit 1 };" ^
"try {" ^
" Rename-Printer -Name '%OldName%' -NewName '%NewName%';" ^
" Write-Host '[SUCCESS] Printer renamed to: %NewName%'" ^
"} catch { Write-Host '[ERROR]' $_.Exception.Message; exit 1 }"
if %errorlevel% neq 0 (
echo [ERROR] Rename failed. Ensure you are running as ADMIN.
)
echo %date% %time% - Renamed "%OldName%" to "%NewName%" >> printer_asset_log.txt
pause
Modifying the system-level name of a hardware device requires elevated privileges. You MUST run your script as an Administrator.
Method 2: Rename with Share Name Update
If the printer is shared on the network, renaming it locally does not update the share name. This method handles both to keep them synchronized.
@echo off
set "OldName=Zebra_GK420t"
set "NewName=Labeler_Station_A"
set "ShareName=Labeler_A"
echo [ACTION] Updating printer identity and network share...
powershell -NoProfile -Command ^
"$p = Get-Printer -Name '%OldName%' -ErrorAction SilentlyContinue;" ^
"if (-not $p) { Write-Host '[ERROR] Printer not found: %OldName%'; exit 1 };" ^
"try {" ^
" Rename-Printer -Name '%OldName%' -NewName '%NewName%';" ^
" Write-Host '[SUCCESS] Renamed to: %NewName%';" ^
" if ($p.Shared) {" ^
" Set-Printer -Name '%NewName%' -ShareName '%ShareName%';" ^
" Write-Host '[SUCCESS] Share name updated to: %ShareName%';" ^
" Write-Host 'New network path: \\%COMPUTERNAME%\%ShareName%'" ^
" }" ^
"} catch { Write-Host '[ERROR]' $_.Exception.Message; exit 1 }"
if %errorlevel% neq 0 (
echo [ERROR] Operation failed. Ensure you are running as ADMIN.
)
pause
Method 3: Standardizing Your Fleet
Use this script to clean up the names of multiple printers on a machine according to a corporate naming standard.
@echo off
echo [LOG] Standardizing printer names...
echo.
:: Define rename mappings (OldName=NewName)
:: Add or remove lines as needed for your environment
set "Map1=HP_LaserJet_1020=Reception_BW"
set "Map2=Zebra_GK420t=Warehouse_Labeler"
for %%M in ("%Map1%" "%Map2%") do (
for /f "tokens=1,2 delims==" %%a in (%%M) do (
powershell -NoProfile -Command ^
"$p = Get-Printer -Name '%%a' -ErrorAction SilentlyContinue;" ^
"if (-not $p) { Write-Host '[SKIP] Not found: %%a'; exit 0 };" ^
"try { Rename-Printer -Name '%%a' -NewName '%%b'; Write-Host '[RENAMED] %%a -> %%b' }" ^
"catch { Write-Host '[FAILED] %%a :' $_.Exception.Message }"
)
)
echo.
echo [DONE] Fleet standardization complete.
pause
How to Avoid Common Errors
Wrong Way: Thinking "Renaming" changes the Share Name
If you rename a printer on your local machine, the Network Share Name (the name other people see when they search for it) stays the same.
Correct Way: If you want other people to see the new name on the network, you must also update the sharing properties. Method 2 handles both the local rename and the share name update in a single operation.
Problem: Active Jobs
You cannot rename a printer if the Spooler is actively sending a document to it.
Solution: Run a "Clear Print Queue" or "Restart Spooler" script before performing a rename to ensure the printer is completely idle.
Best Practices and Rules
1. Avoid Special Characters
While Windows allows many characters, keep your printer names restricted to letters, numbers, and hyphens (e.g., Sales-Color-01). Avoid using symbols like &, (, or $ as they can break other scripts or legacy software.
2. Identify "Point and Print"
If you rename a printer on a Print Server, all the "Client" computers that are connected to it might lose their connection because the path they were looking for has changed. You will need to update the client scripts as well.
3. Log the Identity Change
In a corporate audit, it's important to know when and why a device's name was changed.
echo %date% %time% - Renamed "%OldName%" to "%NewName%" >> printer_asset_log.txt
Conclusions
Renaming printers via Batch script is a professional way to maintain order and clarity in your office infrastructure. By moving from manual naming to automated standardization, you ensure that every device is easy to find and use for every employee. This level of organizational precision is essential for anyone managing a growing Windows environment where clear communication and efficient workflows are non-negotiable.