# Dos function in Scilab

**URL:** <https://scilab.discourse.group/t/dos-function-in-scilab/567>\
**Category:** General usage\
**Created:** [June 22, 2024, 7:46am UTC](https://scilab.discourse.group/t/dos-function-in-scilab/567 "2024-06-22T07:46:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arctica](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@arctica](https://scilab.discourse.group/u/arctica)\
**Post date:** [June 22, 2024, 7:46am UTC](https://scilab.discourse.group/t/dos-function-in-scilab/567/1 "2024-06-22T07:46:31Z")

</div>

As an observation, the dos function does not function as it should under Windows, and requires a simple workaround.

For example:

[result, bOK]=dos(‘grdinfo faa\_test\_1m.grd’)

result =

“Error returned from GMT API: GMT\_MEMORY\_ERROR (25)”

bOK =

F

However, applying a simple function resolves this on Windows:

```auto
function [result, bOK]=dos_win(x)
    [result, bOK] = dos('exit |'+ x);
endfunction

```

This seems to work fine and the “exit” part prevents the cmd terminal launching.

[result, bOK]=dos\_win(‘grdinfo faa\_test\_1m.grd’)

result = [11x1 string]

"faa\_test\_1m.grd: Title: "  
“faa\_test\_1m.grd: Command: gmt grdcut @earth\_faa\_01m\_p/ -Gfaa\_test\_1m.grd -R-10/10/-10/10 -V”

"faa\_test\_1m.grd: Remark: "  
“faa\_test\_1m.grd: Pixel node registration used [Geographic grid]”  
“faa\_test\_1m.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7”  
“faa\_test\_1m.grd: x\_min: -10 x\_max: 10 x\_inc: 0.0166666666667 (1 min) name: longitude n\_columns: 1200”

“faa\_test\_1m.grd: y\_min: -10 y\_max: 10 y\_inc: 0.0166666666667 (1 min) name: latitude n\_rows: 1200”

“faa\_test\_1m.grd: v\_min: -104.800018311 v\_max: 455.225006104 name: z”  
“faa\_test\_1m.grd: scale\_factor: 1 add\_offset: 0”  
“faa\_test\_1m.grd: format: netCDF-4 chunk\_size: 134,134 shuffle: on deflation\_level: 3”  
“faa\_test\_1m.grd: Default CPT: @earth\_faa.cpt”

bOK =

T

For reference, this issue appeared to start after the transition to Scilab 6.x.x, version 5.5.2 did not have an issue, so not sure what changed. Clearly, the cause of the problem still persists; this was reported on the mailing list previously, but is just something to be aware of on Windows.

Lester

---

<div class="post-metadata">

**Author:** ![arctica](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@arctica](https://scilab.discourse.group/u/arctica)\
**Post date:** [December 5, 2024, 12:55pm UTC](https://scilab.discourse.group/t/dos-function-in-scilab/567/2 "2024-12-05T12:55:14Z")

</div>

Update using Scilab 2025.0.0

The DOS function as listed in the documentation still not working properly under Windows 11 command shell to run external cmd-line programs. The fix quoted before still works.

function [result, bOK]=dos\_win(x)  
[result, bOK] = dos(‘exit |’+ x);  
endfunction

Lester
