123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- @echo off
- setlocal enabledelayedexpansion
- %1 %2
- set result=-1
- ver|find "5.">nul&&goto :admin
- mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :admin","","runas",1)(window.close)&goto :eof
- :admin
- set result=0
- taskkill /F /IM sphost.exe
- taskkill /F /IM spshell.exe
- if %errorlevel% neq 0 (
- if %errorlevel% equ 128 (
- echo specified process is not existed.
- ) else (
- echo error occurs: %errorlevel%
- )
- ) else (
- echo normal resut delay 3 seconds for safety.
- rem delay seconds
- choice /t 3 /d y /n >nul
- )
- echo current disk: %~d0
- set run_path=%~d0
- set relate_path="\\Run\\version\\spexplorer.vbs"
- set exec_path=%run_path%%relate_path%
- echo execute path: %exec_path%
- rem start %exec_path%
- for /f "delims=" %%i in ('cscript //nologo %exec_path%') do set "d=%%i"
- echo %d%
- choice /t 15 /d y /n >nul
- set has_sphost=no
- set has_spshell=no
- for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq spshell.exe"') do if %%a == spshell.exe set has_spshell=yes
- for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq sphost.exe"') do if %%a == sphost.exe set has_sphost=yes
- if %has_sphost% == yes (
- echo sphost is loaded successfully.
- ) else (
- echo sphost is boost failed!!
- set result=-1
- )
- if %has_spshell% == yes (
- echo spshell is loaded successfully.
- ) else (
- echo spshell is boost failed!!
- set result=-1
- )
- :eof
- echo result: %result%
- exit /b %result%
|