I've got it.

Code:


; -----------------------------------------------------------------------
; Doc_path.kix
; -----------------------------------------------------------------------
; The script changes the destination of the default document location of
; the applications:
; MS Excel
; MS Word
; MS Powerpoint
; -----------------------------------------------------------------------
; Samengesteld door Frans Erich
; f.j.erich@ict.azg.nl
; f.erich@chello.nl
; -----------------------------------------------------------------------
; Updated by
;
; -----------------------------------------------------------------------
; Dependencies
; - Kixtart version 4.1 or later
; - Function udfSqueeze
; - Function WshPipe
; - Windows Script Host
; -----------------------------------------------------------------------
; Credits to
; The builetin board communities of www.kixtart.org and www.kixscripts.com
; Special thanks to builetin board modorators:
; - Richard H.
; - sealeopard
; - Chris S.
; - NTDOC
; -----------------------------------------------------------------------
; Variables
$search = " H:"
$word_key = "HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Word\Options"
$excel_key = "HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\Microsoft Excel"
$powerpoint_key = "HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default"
; -----------------------------------------------------------------------

Function udfSqueeze($sSource,Optional $sDelimiters, Optional $bTrim)
Dim $iSourceLength $iSourceLength=0
Dim $iIndex $iIndex=0
Dim $iLastGood $iLastGood=0
Dim $bFound $bFound=0

$udfSqueeze=""

; --------------------------
; Defaults and sanity checks
; --------------------------
If $sDelimiters="" $sDelimiters=" " EndIf
If $bTrim $bTrim=1 Else $bTrim=0 EndIf

; ----------------------------------------
; High speed squeeze for single characters
; ----------------------------------------
If Len($sDelimiters)=1
$sDelimiters=""+$sDelimiters+$sDelimiters
$iIndex=InStr($sSource,$sDelimiters)
While $iIndex
$sSource=""+SubStr($sSource,1,$iIndex)+SubStr($sSource,$iIndex+2,Len($sSource))
$iIndex=InStr($sSource,$sDelimiters)
Loop
If $bTrim
$sDelimiters=SubStr($sDelimiters,1,1)
; -------------
; Trim leading.
; -------------
While SubStr($sSource,1,1)=$sDelimiters
$sSource=SubStr($sSource,2,Len($sSource))
Loop
; --------------
; Trim Trailing.
; --------------
$iIndex=Len($sSource)
While SubStr($sSource,$iIndex,1)=$sDelimiters
$sSource=SubStr($sSource,1,$iIndex-1)
$iIndex=Len($sSource)
Loop
EndIf
$udfSqueeze=$sSource
Else
; --------------------------------------
; Slower squeeze for multiple characters
; --------------------------------------
$iSourceLength=Len($sSource)
For $iIndex = 1 To $iSourceLength
$cChar=SubStr($sSource,$iIndex,1)
If InStr($sDelimiters,$cChar)
If $bFound=0 AND ( $iLastGood OR $bTrim=0 )
$udfSqueeze=""+$udfSqueeze+SubStr($sDelimiters,1,1)
EndIf
$bFound=1
Else
$bFound=0
$udfSqueeze=""+$udfSqueeze+$cChar
If $bTrim $iLastGood=Len($udfSqueeze) EndIf
EndIf
Next
If $iLastGood $udfSqueeze=SubStr($udfSqueeze,1,$iLastGood) EndIf
EndIf

EndFunction
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If NOT VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
While NOT $oExec.Status Loop
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If NOT $NoEcho $Output EndIf
$WshPipe=Split($Output,Chr(10))
Exit($oExec.ExitCode)
EndFunction

Break on
$CharNr = ""
$rc=WshPipe("%comspec% /c net use",1)
For Each $line In $rc
If InStr($line,$search)
$linepart=Split(udfSqueeze($line," ","true"))
; The next 3 lines strip a cha
$CharNr = Len ($linepart[2])
$CharNr = $CharNr - 1
$pad = Left ($linepart[2],$CharNr)
$ = WriteValue ($word_key,"DOC-PATH",$pad,"reg_sz")
$ = WriteValue ($excel_key,"DefaultPath",$pad,"reg_sz")
$ = WriteValue ($powerpoint_key,"",$pad,"reg_sz")
$linepart[2] ?

EndIf
Next
:END



Thanks a lot for the help you gave,

GP