This should do it..

code:
IF exist("H:\nul")
$ps = "H:\Scripts_DO_NOT_DELETE\Printsetup.ini" ; -- Print Configuration File
IF GETFILEATTR("H:\Scripts_DO_NOT_DELETE") & 16
ELSE
SHELL "%comspec% /c md H:\Scripts_DO_NOT_DELETE"
ENDIF
IF EXIST($windir+"\Printsetup.ini")
DEL $windir+"\Printsetup.ini"
ENDIF
ELSE
IF EXIST($windir+"\Printsetup.ini")
DEL $windir+"\Printsetup.ini"
ENDIF
IF exist($systemdrive+"\Scripts\nul")
$ps = $systemdrive+"\Scripts\Printsetup.ini" ; -- Print Configuration File
ELSE
SHELL "%comspec% /c md "+$systemdrive+"\Scripts"
$ps = $systemdrive+"\Scripts\Printsetup.ini" ; -- Print Configuration File
ENDIF
ENDIF

$subkey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows"
$value = ReadValue( $subkey, "Device" )
IF 0 = InStr($value, "") ; -- IT IS NULL
RETURN ; -- NO PRINTER NOR INI FILE FOUND
ENDIF

; -- Let's manipulate some strings

$offset = InStr( $value, "," ) ; Parse name from string
$len = $offset - 1
$lpt1 = SUBSTR( $value, 1, $len )

$RC = WRITEPROFILESTRING($ps,"Printers","Default",$lpt1)

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's