DOS In Translation

版本 1.7.0.0 (2.6 KB) 作者: Jerome Briot
Execute DOS command and return output with good character encoding
292.0 次下载
更新时间 2014/12/11

查看许可证

On systems with some language settings, the dos function doesn't encode properly the output string. For example, the accentued characters are misinterpreted with french settings. dosWithCharEncod mimics the dos function but returns the output string with the good character encoding.
Example :
>> command = ['tree "' fullfile(matlabroot, 'bin') '"'];
>> [status, cmdout] = dos(command, '-echo');
Structure du dossier
Le num‚ro de s‚rie du volume est D0DB-13B6
C:\MATLAB\R2014A\BIN
ÃÄÄÄm3iregistry
ÃÄÄÄregistry
ÃÄÄÄutil
³ ÀÄÄÄmex
ÀÄÄÄwin64
ÃÄÄÄaccessible
ÃÄÄÄcodecs
ÃÄÄÄgraphicssystems
ÃÄÄÄiconengines
ÃÄÄÄimageformats
ÃÄÄÄmexopts
³ ÀÄÄÄcompilerComponents
ÃÄÄÄosgPlugins-3.0.1
ÀÄÄÄvc90
>> [status, cmdout] = dosWithCharEncod(command, '-echo');
Structure du dossier
Le numéro de série du volume est D0DB-13B6
C:\MATLAB\R2014A\BIN
├───m3iregistry
├───registry
├───util
│ └───mex
└───win64
├───accessible
├───codecs
├───graphicssystems
├───iconengines
├───imageformats
├───mexopts
│ └───compilerComponents
├───osgPlugins-3.0.1
└───vc90

dosWithCharEncod is inspired by the solutions given in:
- http://www.mathworks.de/matlabcentral/newsreader/view_thread/238995
- http://www.mathworks.com/matlabcentral/answers/112639-matlab-recognise-french-character#answer_128355

引用格式

Jerome Briot (2025). DOS In Translation (https://www.mathworks.com/matlabcentral/fileexchange/48088-dos-in-translation), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.7.0.0

'-echo' behavior corrected (as suggested by Mikhail)

1.6.0.0

Use a try-catch block as suggested by Mikhail

1.5.0.0

Check if "command" is a string (see last comments from Mikhail)

1.4.0.0

Internal variable "echo" renamed (conflict with builtin function)

1.3.0.0

'"' added in the command line example.

1.2.0.0

Add feature('locale') - See Mikhail comment above
Keep getCurrentCodePage() subfunction for backward compatibility (field terminalEncoding doesn't exist with MATLAB R2008b)

1.1.0.0

- missing subfunction added

1.0.0.0