Matlab giving error due to space between "Program Files" folder name

490 views Asked by At

I am trying to unzip a file using Matlab by calling WinRAR through system function of the Matlab. When I gave the path of the WinRAR exe to the system command, I got the folliwng error about the "Program Files" folder:

'C:\Program' is not recognized as an internal or external command, 
operable program or batch file.

My code is as follows:

str = ['C:\Program Files\WinRAR\UnRAR.exe',' ',filename];
system(str)

How may I remove this error about the space between the folder name "Program Files"?

1

There are 1 answers

1
rinkert On

Put the path between double quotes:

str = ['"C:\Program Files\WinRAR\UnRAR.exe"',' ',filename];
system(str)