How to check if an (.exe) file is installed or not?

조회 수: 22 (최근 30일)
Wael Wanis
Wael Wanis 2019년 10월 27일
댓글: Noah Kilps 2020년 11월 5일
Hello everyone,
I am using MATLAB R2019b on windows 10.
I am designing a GUI, i need when the user pushes the Start button, MATLAB automatically checks if "FreeFem++" program is installed on the device or not?
i read about the command:
exist launchff++.exe
But it only searches in the current folder where the GUI exists, not on all the device.
And if the program is installed, I don't know its location.
So how can i search for the file everywhere or more importantly in the control panel?
I tried:
exist 'Control Panel\Programs\Programs and Features'
but it doesn't work, apparently exist command doesn't have access to search in the control panel.
Thank you in advance.
  댓글 수: 3
Wael Wanis
Wael Wanis 2019년 10월 30일
Then "exist" command is not the solution that I seek because I don't know the path of the file that I am searching for. I don't know if the file exits in the first place or not.
I don't understand how "system" command is relevant to know if a program is installed or not.
"system" command opens another software or a file that exists in the current folder.
Wael Wanis
Wael Wanis 2019년 11월 2일
i figured out how to use "system" command to check if the program is installed or not.
Thank you for pointing me towards it.

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

채택된 답변

Hari Krishna Ravuri
Hari Krishna Ravuri 2019년 10월 31일
system is used to execute operating system command and return the output.The function starts a new cmd/shell process, executes the command, exits the process, and returns to the MATLAB process.Please refer https://in.mathworks.com/help/matlab/ref/system.html for more information regarding system.
In this case,as you are using a Windows10 machine, you may consider executing the below instruction to get the list of installed applications.
system("wmic product get name,version")
Hope this helps!
  댓글 수: 2
Wael Wanis
Wael Wanis 2019년 11월 2일
thank you.
I used system command to check it and it works.
However this exact line "system("wmic product get name,version")" didn't show me all the installed programs that I have, maybe it only shows those on C drive?
anyway thanks again
Noah Kilps
Noah Kilps 2020년 11월 5일
Hello,
I have a follow up question to this. What if I only want to know if excel is installed? how would
system("wmic product get name,version")
be written differently?

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by