Explorar el Código

T20M5021 #comment 初步添加运行框架的BAT脚本

gifur hace 5 años
padre
commit
8d3a84d797
Se han modificado 2 ficheros con 56 adiciones y 0 borrados
  1. 1 0
      CMakeLists.txt
  2. 55 0
      test/rvc_test.bat

+ 1 - 0
CMakeLists.txt

@@ -368,6 +368,7 @@ install(FILES ${active_txt_file} DESTINATION ${PACK_INSTALL_PREFIX_VERSION} COMP
 install(DIRECTORY "${CMAKE_SOURCE_DIR}/addin/hardwarecfg" DESTINATION "${PACK_INSTALL_PREFIX_ORIGIN}" COMPONENT scripts)
 if(MSVC)
 	file(GLOB BAT_SCRIPTS "${CMAKE_SOURCE_DIR}/addin/startup_scripts/*.vbs")
+	install(FILES "${CMAKE_SOURCE_DIR}/test/rvc_test.bat" DESTINATION ${OUTPUT_CUR_DISK_PATH}  COMPONENT scripts)
 else(MSVC)
 	file(GLOB BAT_SCRIPTS "${CMAKE_SOURCE_DIR}/addin/startup_scripts/*.sh")
 endif(MSVC)

+ 55 - 0
test/rvc_test.bat

@@ -0,0 +1,55 @@
+@echo off
+setlocal enabledelayedexpansion
+
+%1 %2
+ver|find "5.">nul&&goto :admin
+mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :admin","","runas",1)(window.close)&goto :eof
+:admin
+
+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
+set result=0
+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
+)
+echo "result: " %result%
+exit /b result