This is a KIX32 script. Save it as PrintDOS.kix.
Go to
http://www.kixtart.org and download KIX32. The only file you need is
KIX32.EXE.
Copy both files (PrintDOS.kix and KIX32.exe) to WINNT\SYSTEM32.
Edit WINNT\SYSTEM32\USRLOGON.CMD and at the end add a line:
KIX32.EXE PrintDOS.kix
This will do it.
--
Cláudio Rodrigues, MVP
Windows 2000/NT Server
Terminal Services
http://www.terminal-services.NET
-> The only Terminal Services Client for DOS.
-> The only customized RDP5.1 client with the close button disabled!
-> Developers of SecureRDP, the BEST security utility for TS!
Do NOT email me directly UNLESS YOU KNOW ME or you are a Microsoft
MVP/Employee.
Use my support page on my website to submit your questions directly.
Cláudio Rodrigues wrote
Thanks again Cláudio. Please excuse my ignorance, I'm new to Terminal Server
and I'm not familiar with scripting either. I need a little help in getting
this script to run. Not knowing what I'm doing, I'm guessing and apparently
I'm doing something wrong. I created a text file that contains your script
and I named it printdos.cmd. Is this the correct way to make an executable
script? I placed the printdos.cmd on the server, connected to the server
from the TS client, ran the printdos.cmd file from the command prompt to
test it. The ";" were not recognized as "rem" and those lines attempted to
run. I then replaced each ";" with "rem" and tried again. Is there another
way to run the script without the need to do this?
After rem-ing out the ";'" I still get several "not recognized as an
internal or external command" error messages. I suspect some(or maybe all)
of these errors are due to line wrapping in the post of your script and
partial lines are attempting to run. I don't understand enough about the
commands in the script to determine the correct place for the line break.
Could you seperate the indivudial lines of the script by a blank line or
place a "<LB>" at the end of each line? I'd really appreciate it. Am I doing
anything else wrong? I've pasted the screen output that results from running
the script below.
Thank you,
Steve Smith
C:\Documents and Settings\Steve\Desktop>printdos
C:\Documents and Settings\Steve\Desktop>REM Get the default printer name and
s
re/map it for DOS apps.
C:\Documents and Settings\Steve\Desktop>REM By Clßudio Rodrigues,
http://www.T
minal-Services.NET
C:\Documents and Settings\Steve\Desktop>REM Example String: HP LaserJet
4Si/CL
DIOXP/Session 1,winspool,TS002
C:\Documents and Settings\Steve\Desktop>REM Reads the default printer from
the
egistry.
C:\Documents and Settings\Steve\Desktop>$DefaultPrinter =
ReadValue("HKEY_CURR
T_USER\Software\Microsoft\Windows
'$DefaultPrinter' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>NT\CurrentVersion\Windows","Device")
The system cannot find the path specified.
C:\Documents and Settings\Steve\Desktop>REM Extracts the printer name on the
T
Example: HP LaserJet
C:\Documents and Settings\Steve\Desktop>4Si/CLAUDIOXP/Session 1
'4Si' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$WhereisComma =
InStr("$DefaultPrinter
",") - 1
'$WhereisComma' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$TSPrinterName =
Left("$DefaultPrinter
"$WhereisComma")
'$TSPrinterName' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>REM Extracts the machine
name/Session
.. Example: CLAUDIOXP/Session 1
C:\Documents and Settings\Steve\Desktop>$WhereisSlash =
InStr("$TSPrinterName"
/") - 1
'$WhereisSlash' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$MachineAndSSID =
Left("$DefaultPrinte
,"$WhereisSlash")
'$MachineAndSSID' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>REM Extracts the Session ID only
from
e string above. Example: 1
C:\Documents and Settings\Steve\Desktop>$PosTemp =
InStr("$TSPrinterName","/")
'$PosTemp' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$EndTemp = Len("$TSPrinterName") -
$Po
emp
'$EndTemp' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$TempStr =
Right("$TSPrinterName","$En
emp")
'$TempStr' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$PosTemp = InStr("$TempStr","/")
'$PosTemp' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$EndTemp = Len("$TempStr") -
$PosTemp
'$EndTemp' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$TempStr =
Right("$TempStr","$EndTemp"
'$TempStr' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$Pos2 = InStr("$TempStr"," ")
'$Pos2' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$End3 = Len("$TempStr") - $Pos2
'$End3' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$SSID = Right("$TempStr","$End3")
'$SSID' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$ShareName = "TSPrinter" + $SSID
'$ShareName' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Steve\Desktop>$TSPrinterName = chr(34) +
$TSPrinterN
e + chr(34)
'$TSPrinterName' is not recognized as an internal or external command,
operable program or batch file.
< was unexpected at this time.
C:\Documents and Settings\Steve\Desktop>If Len($LocalPrinter) <> 0
C:\Documents and Settings\Steve\Desktop>