How can I get the short path for a Windows long path using MATLAB 7.8 (R2009a)?

15 次查看(过去 30 天)
I would like to be able to get the short path in 8.3 format for a certain path, for example:
"C:\Program Files" should be transformed to "C:\Progra~1"

采纳的回答

MathWorks Support Team
The ability to transform long paths to short paths is not available in MATLAB.
To work around this issue, if you have the Real Time Workshop (RTW), you can use a built-in function:
RTW.transformPaths('C:\Program Files')
An alternative that does not require the RTW uses the Windows File System Object:
function shortPath = getshortpath(longPath)
fs = actxserver('Scripting.FileSystemObject');
shortPath = fs.GetFolder(longPath).ShortPath;
fs.delete;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

尚未输入任何标签。

产品


版本

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by