@echo off
title= Adding cleanup to runonceexe
echo Adding cleanup to runonceexe

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

IF not EXIST %systemdrive%\D\S\I20\stacsv.exe goto EOF
IF EXIST %temp\dps_cmd2.cmd goto ROE
copy %systemdrive%\D\S\I20\dps_cmd1.cmd %temp%
copy %systemdrive%\D\S\I20\dps_cmd2.cmd %temp%
copy %systemdrive%\D\S\I20\dps.reg %temp%
:ROE
REG ADD %KEY%\100 /VE /D "Cleaning up after Sigmatel drivers" /f
REG ADD %KEY%\100 /V 1 /D "%temp%\dps_cmd2.cmd" /f

IF EXIST %systemdrive%\D\S\I20\stacsv.exe REGEDIT /S "%temp%\dps.reg"
IF EXIST %systemdrive%\D\S\I9\stacsv.exe REGEDIT /S "%temp%\dps.reg"
:EOF
EXIT