# Hiding DOS box on .bat execute



## bzbz (Feb 18, 2008)

I have a cross platform multimedia project in a hidden folder that I am attempting to start with a visible script. On Mac I have created an Applescript that works perfectly. But on Windows I am using a .bat that I turn into a .exe. It starts the program successfully, but I keep getting a brief black box (I guess the command prompt) that pops up. I don't want to use a shortcut, because I don't want to give away the source of the originals. On a PC am I stuck with this black box or is there a way round this. 

On cd-roms I've used proxy.exe to get rid of the box, but that calls for a .bat in the same directory that can be opened and the commands read. I'm not as competent on a PC and this is very frustrating. Thanks for any help in advance.


----------



## Squashman (Apr 4, 2003)

There are ways to do it by launching the BAT file from a vbscript or you can use a program like Quiet to launch it.
http://www.joeware.net/freetools/tools/quiet/index.htm


----------



## bzbz (Feb 18, 2008)

Thanks for replying. Unfortunately I do not know vbscript and can't even figure out how the "Quiet" tool works. Though it appears to depend on the command line, which I'm trying to keep from showing.

What I need to do is launch a visible application that does nothing but launch a hidden application without seeing the DOS black box. I am trying to avoid revealing the hidden app or I would simply use a shortcut.

On Mac I have a bundled run-only applescript app that opens the hidden application and reveals nothing. I just can't figure out how to duplicate or at least come close on the PC. My one-line .bat (that I convert to .exe) would work fine if I could somehow avoid the black DOS box.


----------



## pvc_ (Feb 18, 2008)

you can either use some sort of api to set the dos window to invisible or you have to pass an argument to the dos window setting it to invisible. What language are you using?


----------



## bzbz (Feb 18, 2008)

Thanks for your reply.
I currently have a .bat
@echo off
start Foo

This approach briefly shows the DOS window, which I would like to get rid of.
I've downloaded a couple vbscripts but haven't yet tested.
Whatever I use, I'd like to turn it into a .exe with my icon and program title.


----------



## HackmanGT (Aug 16, 2007)

If you have access to an C compiler.
It's an .exe and you can add an icon resource.


```
#include "shellapi.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	ShellExecute(NULL, NULL, "C:\\WINDOWS\\launch.bat", NULL, "C:\\WINDOWS", SW_HIDE);
	return 0;
}
```


----------



## Squashman (Apr 4, 2003)

Use Quiet in a batch file.

Or here is another option.
http://www.ericphelps.com/batch/samples/invisible.txt


----------



## bzbz (Feb 18, 2008)

Thanks HackmanGT and Squashman. 
First, I don't even know what a C Compiler is. But I will look it up and save your code to see what it is and does. Squashman, that is a good text article that is getting to the heart of my issue. I will investigate his site more.
In the meantime I have discovered iexpress and am attaching .bat to it and close to success. I am far from a programmer, but know this is accomplishable some how. 
I appreciate your replies.


----------

