Closing an .exe application

조회 수: 40 (최근 30일)
Karl Rueth
Karl Rueth 2018년 3월 16일
댓글: varuliantor dear 2021년 9월 12일
I am having an issue with closing an application which is currently open; I am using this code ..
fileexe_path = which ('Myo Data Capture.exe');
system_command_string = [fileexe_path, ' &'];
status = system (system_command_string);
pause(3);
TASKKILL /? -f -im Windows Command Processor.exe;
Which after 3 Seconds should close the application, (Windows Command Processor) is the name of the application in the task manager.
The Following error is showing;
Undefined function or variable 'TASKKILL'.
Error in CalibrationRoutine (line 19) TASKKILL /? -f -im Windows Command Processor.exe;
  댓글 수: 2
Rik
Rik 2018년 3월 16일
You need to pass the command you want to run to system as a complete string.
varuliantor dear
varuliantor dear 2021년 9월 12일
system('taskkill /? -f -im Windows Command Processor.exe')

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2018년 3월 16일
편집: Jan 2018년 3월 16일
Do you mean:
system('TASKKILL -f -im "Windows Command Processor.exe"');
? The "/?" is not useful here.
Do you really want to kill the the "Windows Command Processor" task? This sounds strange. I'd expect that you want to kill "Myo Data Capture.exe". A hard kill after 3 seconds is dangerous in every case: What happens, if you get an email notification, the hard disk optimizing starts and an Windows Update slows down the computer? There must be a better trigger for killing than a fixed interval of time.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by