problem trying to Install *.exe with Matlab 'system' command

Dear Experts,
I am trying to install and exe file using the system command. The function fails, resulting in a -1 status and no cmd output message.
The command is:
[status,cmdm] = system('D:\dbLNI_Finder.exe')
The file exists:
If I try to perform the same command for the same file but in a specific location (a pen drive) it works:
system('H:\for win\dbLNI_Finder.exe')
I tried to copy and replace the file several times, but no.
Any idea? Thanks!

5 comentarios

I also copied the string into cmd directly: worked.
Jan
Jan el 7 de Feb. de 2018
Editada: Jan el 7 de Feb. de 2018
@Brunno: Which string? Was it a command shell started with admin privileges? With which privileges does your Matlab run?
I'd expect this to fail:
system('H:\for win\dbLNI_Finder.exe')
due to the space in the path.
I'm even not sure what "install and exe file using the system command" exactly means. Do you want to run it or is this an installer, which e.g. asks for admin privileges?
The Matlab 'system' function needs a string to run, e.g.:
system('notepad') %opens the notepad
my code creates the input string of the 'system' function [path,filesep,'dbLNI_Finder.exe']:
system([path,filesep,'dbLNI_Finder.exe'])
which means:
system('C:\Users\BMC\DBlni_Find\dbLNI_Finder.exe')
PS: C:\Users\BMC\DBlni_Find\dbLNI_Finder.exe works using Windows CMD
Yes, but this:
system('H:\for win\dbLNI_Finder.exe')
is exactly the command that is working, from this pen drive H:\
Sorry, I meant: 'install a *.exe file using the 'Matlab" system command.'
tks
@Brunno: Your problem is solved now. Then it does not matter, that I still do not understand the explanations.
Does
system('C:\Users\BMC\DBlni_Find\dbLNI_Finder.exe')
work or not?
As far as I understand, you do not want to install this executable, but run it.
@Jan: the command
system('C:\Users\BMC\DBlni_Find\dbLNI_Finder.exe')
work only if I open Matlab as admin.
Yes, 'run'. Install the software by running the executable.

Iniciar sesión para comentar.

 Respuesta aceptada

Brunno Machado de Campos
Brunno Machado de Campos el 7 de Feb. de 2018
Editada: Brunno Machado de Campos el 7 de Feb. de 2018
Although I am the PC admin, the command worked only when I open the Matlab in Admin mode (right-click >> open as adm). Since this code is for a deployed application, my deployed application is also able to install the *.exe only if opened as admin.
Now, why I the 'system' function worked installing the *.exe from the PenDrive (an only from the pen drive) without mode restrictions for me, is a mystery (in terms of security, somewhat contradictory).
At the end, I understood that the system() function and the CMD have distinct permission executing the same command. Good to know.
Tks.

Más respuestas (1)

Jan
Jan el 7 de Feb. de 2018
Check the settings of your virus protection. Does it allow to start executables from the concerned folder?

3 comentarios

Thanks, but there is no antivirus limitation for sure. As I mentioned, if I copy the exact string and paste into cmd, the exe executes. Also: - I am the PC admin. - tried several distinct locations as Desktop, Documents, D:, E:... using Matlab, I immediately get the -1 status.
Jan
Jan el 7 de Feb. de 2018
My antivirus program does not allow all applications to start executables from arbitrary folders. This is thought to stop crypto-trojans.
You did not tell us, if you have opened the Windows Command Shell with admin privileges or not.
This is the tricky part: NO, the Command Shell was opened without admin privileges and was able to install. The Matlab without admin privileges, not.
Just to be crystal clear, the Windows user I am using is the admin, maybe this is enough to Windows Command Shell, but was not to Matlab (since I still needed to right-click on Matlab icon and "runs as administrator")
Ok? Thanks!

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by