# Buffer in running external program in loops

**URL:** <https://discourse.julialang.org/t/buffer-in-running-external-program-in-loops/78087>\
**Category:** Performance\
**Tags:** question, run\
**Created:** [March 18, 2022, 2:02pm UTC](https://discourse.julialang.org/t/buffer-in-running-external-program-in-loops/78087 "2022-03-18T14:02:25Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [March 18, 2022, 3:39pm UTC](https://discourse.julialang.org/t/buffer-in-running-external-program-in-loops/78087/26 "2022-03-18T15:39:37Z")

</div>

I need to see your code.  
I suspect, that you are creating your commands using Strings and than you probably do the

```julia-auto
`...` 

```

or the

```julia-auto
Cmd(`...`) 

```

wrong.  
Please try to create a MWE which reproduces your issue without being overly complex. My guess is, while you do this you will solve your issue by your own 😉  
MWE = minimal working example ([Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757))

> [@oheil](#):
>
> ```julia-auto
> run(`cmd start script.bat`)
> 
> ```

And I am pretty sure, that this creates an issue.  
What is done with that is:  
Julia `exec` a `cmd.exe` with `ARGV[1]="start"` and `ARGV[2]="script.bat"`.  
So cmd.exe will start interactive, runs `start` without parameter which fails. Now cmd as an interactive shell stalls whatever is expected to run now.  
I think it would be best to just use

```julia-auto
run(`PATH\TO\script.bat`)

```

without anything else. Or if this is not possible:

```julia-auto
run(`cmd /C "start script.bat"`)

```

The " are important here, because  
`ARGV[1]` must be `/C` and  
`ARGV[2]` must be the whole “`start script.bat`”

You may be able to post again, thanx to @mbauman

---

_[View the full topic](https://discourse.julialang.org/t/buffer-in-running-external-program-in-loops/78087)._
