A short version doing the job in NT and 9x

code:

If @InWin = 1
Shell "%COMSPEC% RD /S /Q %TEMP%"
EndIf
If @InWin = 2
Shell "%COMSPEC% DelTree /Y %TEMP%"
EndIf


Just another way of doing the job if you don't want to call functions outside the script
(You need at least kix version 3.62 to run this script)

code:

CD %TEMP%
GoSub DelTmpDir
Return ; Script finished


; **************************
elTmpDir
; **************************

Dim $SubDir

$FileName = Dir("*.*")
While $FileName <> "" And @Error = 0
If SubStr($FileName, 1, 1) <> "."
If GetFileAttr($FileName) & 16
$SubDir = $FileName
CD $SubDir
GoSub DelTmpDir
CD ".."
$FileName = Dir("*.*")
While $FileName <> $SubDir
$FileName = Dir()
Loop
$Err = SetFileAttr($SubDir, 128)
RD $SubDir ; Delete subdirectory, now empty
Else
$Err = SetFileAttr($FileName, 128)
Del $FileName
EndIf
EndIf
$FileName = Dir()
Loop
Return
; *** END SUB DelTmpDir ***