MATLAB: Am I getting the error: Error using ! DOS commands may not be executed when…

MATLAB

I get the following error when trying to bang out of MATLAB:
Error using ! DOS commands may not be executed when current directory is UNC path name.
Or when using the MEX command:
Error using ! DOS commands may not be executed when current directory is UNC path name. Error in path_to_mex.m on line 121 ->eval(['!mex' sprintf(' %s', varargin{:})]);
I would like to know if MATLAB can use a third party product such as 4NT.EXE in place of CMD.EXE to allow UNC path names.

Best Answer

The error message:
"Error using ! DOS commands may not be executed when current directory is UNC path name."
occurs when you attempt to execute a DOS command from within MATLAB when the current directory is a UNC path. (i.e. if the path name begins with // )
The ! or DOS command from within MATLAB is unable to properly resolve the relative path to the network drive. The workarounds are to either install and use MATLAB locally on the client machine or map the network drive(s) to a valid drive letter(s) so that ! or DOS commands will work properly from within MATLAB.
To map a network drive to your local machine, right-click on "Network Neighborhood" and chose, "Map Network Drive". Note that if you are using the MEX command, you will have to edit your options files to reflect the proper locations of any network drives. You should be sure that you map network drives to the same letters each time you connect to ensure proper operation.
It is not possible to use any third party product in place of CMD.EXE, the default DOS command interpreter.