Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Rem Set the local variables
SetLocal
Rem Wait about 10 seconds to let the terminal server set up the printer...
rem Sleep 10
Rem Reads the default printer from the registry and creates "DefPrint.cmd" to store the info
"%SystemRoot%\Application Compatibility Scripts\acregl.exe" DefPrint.cmd DefaultPrinter "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" "Device" ""
If Not Exist DefPrint.cmd (Call :Error 1) && (Goto EoF)
call DefPrint.cmd
del DefPrint.cmd
If Not Defined DefaultPrinter (Call :Error 2) && (Goto EoF)
REM :: this command should return something like this
REM :: "DefaultPrinter = PrinterName (from WORKSTATION) in session 5,winspool,TS010"
REM :: create variable %OldPrinterString% with a value of "PrinterName (from WORKSTATION) in session 5"
for /f "tokens=1 delims=," %%i in ('"echo %DefaultPrinter%"') do set OldPrinterString=%%i
REM :: create variable %PrinterName% with a value of "PrinterName"
for /f "tokens=1 delims=(" %%k in ('"echo %DefaultPrinter%"') do set PrinterName=%%k
REM :: Notes
REM :: using this string "DefaultPrinter = PrinterName (from WORKSTATION) in session 5,winspool,TS010"
REM :: "delims=," means that each comma is used to seperate each segment of the DefaultPrinter string into a token
REM :: "tokens=1" would return "PrinterName (from WORKSTATION) in session 5"
REM :: "tokens=2" would return "winspool"
REM :: "tokens=3" would return "TS010"
REM :: "delims= " means that each space is used to seperate each segment of the DefaultPrinter string into a token
REM :: "tokens=1" would return "PrinterName"
REM :: "tokens=2" would return "(from"
REM :: "tokens=3" would return "WORKSTATION)"
REM :: take the original printer name ("PrinterName (from WORKSTATION) in session 5") and change it to just "PrinterName"
rundll32 printui.dll,PrintUIEntry /Xs /n "%OldPrinterString%" printername "%PrinterName%"
Rem Done!
EndLocal
Goto EoF
:Error
msg %SessionName% /W Your printer was not successfully configured. Please log off and log on again. If you continue to receive this message, please contact the network Administrator. (Error Code: %1)
EndLocal
Goto EoF
:EoF