# Spawn process in new window

**URL:** <https://discourse.julialang.org/t/spawn-process-in-new-window/727>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 4, 2016, 10:00pm UTC](https://discourse.julialang.org/t/spawn-process-in-new-window/727 "2016-12-04T22:00:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [December 4, 2016, 10:00pm UTC](https://discourse.julialang.org/t/spawn-process-in-new-window/727/1 "2016-12-04T22:00:19Z")

</div>

I’m trying to launch a new process and have it run in a new window. The process I’m trying to spawn is a console application, and I want a new console window to open, in which that process runs. Ideally the new process would also be detached from the current process, i.e. should not be killed when I kill the main julia process.

I’m trying  
`spawn(Cmd(`$(joinpath(JULIA_HOME,Base.julia_exename())) -i`, windows_hide=false, detach=true))`  
But that doesn’t open a new window… I’m on Windows for this.

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [December 5, 2016, 2:47pm UTC](https://discourse.julialang.org/t/spawn-process-in-new-window/727/2 "2016-12-05T14:47:16Z")

</div>

libuv doesn’t appear to have any way to enable the necessary CreateProcess flag for this (`CREATE_NEW_CONSOLE`), and even if it did, that flag is mutually-exclusive [1] with the `DETACH_PROCESS` flag implied by `detach=true`. Calling `AllocConsole` [2] from your code after spawning should give a new cmd window.

[1] [Process Creation Flags (WinBase.h) - Win32 apps | Microsoft Docs](https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx)  
[2] [AllocConsole function - Windows Console | Microsoft Docs](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681944(v=vs.85).aspx)
