rvc_test.bat 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. %1 %2
  4. set result=-1
  5. ver|find "5.">nul&&goto :admin
  6. mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :admin","","runas",1)(window.close)&goto :eof
  7. :admin
  8. set result=0
  9. taskkill /F /IM sphost.exe
  10. taskkill /F /IM spshell.exe
  11. if %errorlevel% neq 0 (
  12. if %errorlevel% equ 128 (
  13. echo specified process is not existed.
  14. ) else (
  15. echo error occurs: %errorlevel%
  16. )
  17. ) else (
  18. echo normal resut delay 3 seconds for safety.
  19. rem delay seconds
  20. choice /t 3 /d y /n >nul
  21. )
  22. echo current disk: %~d0
  23. set run_path=%~d0
  24. set relate_path="\\Run\\version\\spexplorer.vbs"
  25. set exec_path=%run_path%%relate_path%
  26. echo execute path: %exec_path%
  27. rem start %exec_path%
  28. for /f "delims=" %%i in ('cscript //nologo %exec_path%') do set "d=%%i"
  29. echo %d%
  30. choice /t 15 /d y /n >nul
  31. set has_sphost=no
  32. set has_spshell=no
  33. for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq spshell.exe"') do if %%a == spshell.exe set has_spshell=yes
  34. for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq sphost.exe"') do if %%a == sphost.exe set has_sphost=yes
  35. if %has_sphost% == yes (
  36. echo sphost is loaded successfully.
  37. ) else (
  38. echo sphost is boost failed!!
  39. set result=-1
  40. )
  41. if %has_spshell% == yes (
  42. echo spshell is loaded successfully.
  43. ) else (
  44. echo spshell is boost failed!!
  45. set result=-1
  46. )
  47. :eof
  48. echo result: %result%
  49. exit /b %result%