CLS 
@echo off
ECHO.
call  %SystemDrive%\netinst\env_set.bat

echo  ==============winxp4.cmd==================== >>  c:\netinst\install.txt
rem DEL "%systemdrive%\Documents and Settings\Administrator\「开始」菜单\程序\启动\winxpcn2.bat"

rem "%1\soft\batch\win_service_end_ahk.exe"
rem if errorlevel 2 goto error
echo c:\netinst\win_service_end_ahk.exe
"c:\netinst\win_service_end_ahk.exe"
::echo  =%errorlevel%=
::pause
if errorlevel 3 goto clear
if errorlevel 2 goto set_flag
if errorlevel 1 goto error
goto clear
:set_flag
echo set "WIN_SEVICE_END=2" >>  %SystemDrive%\netinst\env_set.bat
:clear

echo  ========指咙H_始============ >>  c:\netinst\install.txt
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo  ========指聋資蕘E=========== >>  c:\netinst\install.txt

echo  setup finished >>  c:\netinst\install.txt
echo  ================================== >>  c:\netinst\install.txt

REG DELETE  "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v batch /f

if "%SYS_MODEL%" == "VMware,Inc.VMwareVirtualPlatform" goto vmware
if "%SYS_MODEL%" == "innotekGmbHVirtualBox" goto virtbox
if "%SYS_MODEL%" == "RedHatKVM" goto redhatkvm
goto ext

:vmware
echo  Copying VMware_Tools_ahk.exe to c:\netinst >>  c:\netinst\install.txt
ECHO Copying VMware_Tools_ahk.exe to c:\netinst
COPY "%BAT_PATH%\VMware_Tools_ahk.exe"  "c:\netinst"

ECHO do install VMware_Tools
echo install VMware_Tools >>  c:\netinst\install.txt
start /wait c:\netinst\VMware_Tools_ahk.exe

goto ext

:virtbox
echo  Copying VirtualBox_Tools_ahk.exe to c:\netinst >>  c:\netinst\install.txt
ECHO Copying VirtualBox_Tools_ahk.exe to c:\netinst
COPY "%BAT_PATH%\VirtualBox_Tools_ahk.exe"  "c:\netinst"


ECHO do install VirtualBox_Tools
echo install VirtualBox_Tools >>  c:\netinst\install.txt
start /wait c:\netinst\VirtualBox_Tools_ahk.exe "5.2.16" 

goto ext

:redhatkvm
echo  Setup spice-guest-tools  >>  c:\netinst\install.txt
ECHO Setup spice-guest-tools
"%SOFT_PATH%\kvm\spice-guest-tools_ahk.exe"   "spice-guest-tools-latest.exe"  "C"

goto ext


:error
::pause
echo Restarting the PC >>  c:\netinst\install.txt
ECHO Restarting the PC
shutdown.exe -r -f -t 5

:ext


EXIT