我想要编写批处理脚本:
我写的但除了运行matlab和matlab app之外没有用:
@ECHO OFF
START cmd.exe /min /k "matlab -nosplash -nodesktop -minimize -r "matlab.apputil.run('ThorlabsLC100APP')""
taskkill /F /IM cmd.exe
SLEEP 30
:search
TASKLIST|FIND "MATLABWindow.exe"
IF %ERRORLEVEL% equ 0 (
GOTO search)
ELSE (GOTO found)
TIMEOUT /T 5
GOTO search
:found
taskkill /im MATLAB.exe
EXIT
由于
答案 0 :(得分:0)
解决:
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
@ECHO OFF
START /min cmd.exe /k "matlab -nosplash -nodesktop -minimize -r "matlab.apputil.run('ThorlabsLC100APP')""
timeout /t 30 /nobreak
:loop
tasklist /FI "IMAGENAME eq MATLABWindow.exe" | findstr "MATLABWindow.exe" >nul
if %ERRORLEVEL% == 1 goto mycode
goto loop
:mycode
taskkill /F /IM MATLAB.exe
taskkill /F /IM cmd.exe
end