I tried writting this, but I can't seem to get it to work.

-------------------


$sysenlog = "H:\Scripts\sysenviro.log"

IF Exist ("$sysenlog") =0
IF (OPEN (1,$sysenlog, 5) = 0)
$Dummy = WriteLine (10, "**** Processing System User Enviroment Setup ****" + Chr(13) + Chr(10))

IF Exist ("H:\Application Data")
$Dir = "H:\Application Data" gosub RMDir
Endif

IF Exist ("h:\Cookies")
$Dir = "h:\Cookies" gosub RMDir
Endif

IF Exist ("h:\Favorites")
$Dir = "h:\Favorites" gosub RMDir
Endif

IF Exist ("h:\Forms")
$Dir = "h:\Forms" gosub RMDir
Endif

IF Exist ("h:\history")
$Dir = "h:\history" gosub RMDir
Endif

IF Exist ("h:\pif")
$Dir = "h:\pif" gosub RMDir
Endif

IF Exist ("h:\system")
$Dir = "h:\system" gosub RMDir
Endif

IF Exist ("h:\Temporary Internet Files")
$Dir = "h:\Temporary Internet Files" gosub RMDir
Endif

IF Exist ("h:\Windows")
$Dir = "h:\Windows" gosub RMDir
Endif

IF Exist ("h:\Office97")
$Dir = "h:\Office97" gosub RMDir
Endif

$Dir = "H:\My Documents" gosub MakeDir
$Dir = "H:\Office97" gosub MakeDir
$Dir = "H:\Office97\Templates" gosub MakeDir
$Dir = "H:\Office97\ExlStart" gosub MakeDir
$Dir = "H:\Office97\WrdStart" gosub MakeDir
$Dir = "H:\Windows" gosub MakeDir
$Dir = "H:\Windows\Forms" gosub MakeDir


$Dir = "H:\Windows\Forms"
if Exist("$Dir") = 0
Shell 'XCOPY "%SystemRoot%\Forms" "$Dir" /E /I'
if @ERROR
$Dummy = WriteLine (10, " Error Copying Files to $Dir" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, " Copied Files to $Dir" + Chr(13) + Chr(10))
endif
endif

$Dir = "H:\Windows\ARTGALRY.cag"
if Exist("$Dir") = 0
COPY "%SystemRoot%\ARTGALRY.cag" "$Dir"
if @ERROR
$Dummy = WriteLine (10, " Error Copying Files to $Dir" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, " Copied Files to $Dir" + Chr(13) + Chr(10))
endif
endif

$Dir = "H:\Office97\Custom.dic"
if Exist("$Dir") = 0
COPY "O:\Microsoft Office\Office\Custom.dic" "$Dir"
if @ERROR
$Dummy = WriteLine (10, " Error Copying Files to $Dir" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, " Copied Files to $Dir" + Chr(13) + Chr(10))
endif
endif

; Fix registry keys.

$RegType="REG_SZ"

$Key="Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
$Entry="Personal"
$Value="H:\My Documents"
gosub UpdateKey

$Office="Software\Microsoft\Office\8.0"

$Key="$Office\Common\Filenew\SharedTemplates"
$Entry=""
$Value="V:\"
gosub UpdateKey

$Key="$Office\Common\Filenew\LocalTemplates"
$Entry=""
$Value="H:\Office97\Templates"
gosub UpdateKey

$Key="$Office\Word\Stationery"
$Entry="Default Template"
$Value="H:\Office97\Templates\Email.dot"
gosub UpdateKey

$Key="$Office\Excel\Microsoft Excel"
$Entry="SavedQueriesFolder"
$Value="H:\My Documents"
gosub UpdateKey

$Entry="DefaultPath"
gosub UpdateKey

$Entry="CmdBarFile"
$Value="H:\Office97\"
gosub UpdateKey

$Entry="AltStartup"
$Value="H:\Office97\ExlStart"
gosub UpdateKey

$Key="$Office\PowerPoint\Command Bars"
$Entry="CmdBarFile"
$Value="H:\Office97\"
gosub UpdateKey

$Key="$Office\PowerPoint\Recent Folder List\Default"
$Entry=""
$Value="H:\My Documents"
gosub UpdateKey

$Key="$Office\Word\Options"
$Entry="AUTOSAVE-PATH"
$Value="H:\My Documents"
gosub UpdateKey

$Entry="STARTUP-PATH"
$Value="H:\Office97\WrdStart"
gosub UpdateKey

:RMDir
Shell '%COMPSEC% /c rmdir "$Dir" /q /s > NUL'
If @ERROR
$Dummy = WriteLine (10, "Error Removing contents $Dir - @SERROR" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, "Deleted $Dir " + Chr(13) + Chr(10))
Endif
RETURN

:MakeDir
if Exist("$Dir") = 0
Md "$Dir"
If @ERROR
$Dummy = WriteLine (10, "Error Creating $Dir - @SERROR" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, "Created $Dir " + Chr(13) + Chr(10))
Endif
Endif
Return

:UpdateKey
Writevalue($Key,$Entry,$Value,"$RegType")
If @ERROR
$Dummy = WriteLine (10, "Error Updating $Key,$Entry,$Value - @SERROR" + Chr(13) + Chr(10))
Else
$Dummy = WriteLine (10, "Updated $Key,$Entry,$Value " + Chr(13) + Chr(10))
Endif
Endif
Return

$Dummy = WriteLine (10, "**** Completed Processing System User Enviroment Setup **** " + Chr(13) + Chr(10))
$Dummy = CLOSE (1)
ENDIF

Return