system() without window

Regan Heath regan at
Wed Jul 11 10:21:59 PDT 2007

okibi wrote:
> Is there documentation somewhere on how these work? Also, will they work on both Windows and Linux?
> Thanks!
> Regan Heath Wrote:
>> okibi wrote:
>>> Hey,
>>> Is it possible to run a command with the system() function without having the program open up a command prompt until it finishes?
>>> Thanks!
>> I doubt it.. but you can call CreateProcess and prevent the window 
>> appearing.  Also there is popen which may prevent it.  Both are more 
>> complicated than system but offer more flexibility too.
>> Regan


You will need to do something like:

extern(C) FILE *popen(const char *command, const char *mode);

in your D source file before you can call it.  See dm\include\stdio.h 
for the function declaration.  Any function you can find in the dm 
include directories can be called like this.

I wrote a ProcessStream using CreateProcess etc which worked on both 
windows and linux (although there may have been a few bugs to deal with):

You can find stuff like this by searching the archives here:


More information about the Digitalmars-d-learn mailing list