Take the 2-minute tour ×

I have many processes in a pipeline style application. Each time I launch the application there will be a different number and order of the processes that make up the pipeline.

My intent is to start them via a master batch file, however I would like to run them without a console window. I could have one console for the batch but I would rather not clutter the user's experience with a 9+ different console windows.

Is there a way to achieve this without installing a service? Or perhaps having a transient service (if that is possible)?


share|improve this question
add comment

2 Answers

Well, in my oppinion you will have to do some development. You could make a launcher application that has no window(There are a lot of info on this subject out there).

Within your launcher app, you will invoke some variant of the CreateProcess Windows API. You might consider playing with the CREATE_NO_WINDOW flag in CreateProcess' dwCreationFlags parameter. Read the docs in MSDN for restrictions.

Here is some code in VC ++ i found on the web, i havent tested it but the idea is there:

// File: Launcher.cpp
// Copyright 2005 (c) by Euphonix, Inc.
// Description: 
// Simple shell application for XPE. Reads a registry entry
// (set via target designer) to find an init file. Reads the
// init file to find an app to launch and working dir to use.
// Launches the app and waits for the launched process to
// terminate.
// If failure occurs anywhere along the way, launches an XP
// command window as a failsafe.
// Author: Fritz Mueller
// Creation Date: 8/3/05
// Implementation Notes:

#define WINVER 0x0501
#include <afxwin.h>

#include <tchar.h>
#include <sstream>

using namespace std;

typedef basic_ostringstream<TCHAR> tostringstream;
typedef basic_string<TCHAR> tstring;

class LauncherErr
LauncherErr(DWORD iCode, const tstring &iDesc) : mCode(iCode), mDesc(iDesc) 
DWORD mCode;
tstring mDesc;

DWORD SpawnProcess(
const tstring &cmdline,
const tstring &workingdir,
DWORD creationFlags)
DWORD result;
BOOL success;

ZeroMemory(&si, sizeof(si));

success = CreateProcess(
NULL, (LPTSTR)cmdline.c_str(), NULL, NULL, FALSE, creationFlags, NULL, 
workingdir.empty() ? NULL : workingdir.c_str(), &si, &pi

if (!success) throw LauncherErr(GetLastError(), _T("Could not create 

result = WaitForSingleObject(pi.hProcess, INFINITE);
if (result == WAIT_FAILED) throw LauncherErr(GetLastError(), _T("Process 
wait failed."));

DWORD exitcode;
success = GetExitCodeProcess(pi.hProcess, &exitcode);
process exit code."));


return exitcode;

int APIENTRY _tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
DWORD result;

try {

HKEY key;
result = RegOpenKey(HKEY_LOCAL_MACHINE, 
_T("Software\\Euphonix\\LauncherShell\\"), &key);
if (result != ERROR_SUCCESS) throw LauncherErr(GetLastError(), _T("Could 
not open launcher registry key."));

DWORD valuetype;
TCHAR initpath[MAX_PATH];
DWORD initpathsize = sizeof(initpath);
result = RegQueryValueEx(key, _T("InitFile"), NULL, &valuetype, 
(LPBYTE)initpath, &initpathsize);
not retrieve init file registry value."));

TCHAR cmdline[MAX_PATH];
DWORD cmdlinesize = MAX_PATH;
cmdlinesize = GetPrivateProfileString(_T("application"), _T("cmdline"), 
NULL, cmdline, cmdlinesize, initpath);
if (cmdlinesize == 0) throw LauncherErr(GetLastError(), _T("Could not 
retrieve command."));

TCHAR workingdir[MAX_PATH];
DWORD workingdirsize = MAX_PATH;
workingdirsize = GetPrivateProfileString(_T("application"), 
_T("workingdir"), _T(""), workingdir, workingdirsize, initpath);

result = SpawnProcess(cmdline, workingdir, DETACHED_PROCESS);   

catch(const LauncherErr &err) {
tostringstream str;
str << _T("cmd /k echo Euphonix Launcher Error (") << err.mCode << _T("): 
") << err.mDesc << endl;
result = SpawnProcess(str.str(), _T(""), CREATE_NEW_CONSOLE);

return (result == ERROR_SUCCESS) ? 0 : -1;

Hope this helps.

share|improve this answer
add comment

If this is being done in a batch file, can't you use START /B?

share|improve this answer
add comment

Your Answer


