Windows Batch script leaves console window open Windows Batch script leaves console window open nginx nginx

Windows Batch script leaves console window open


You could use the /b parameter on START to start the application without opening another cmd window

START /b php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini

Update:
It appears this is the behavior of php-cgi.exe. See this article for the full story and workaround. http://wiki.nginx.org/PHPFastCGIOnWindows

After being launched, php-cgi.exe will keep listening for connections in a command prompt window. To hide that window, use the tiny utility RunHiddenConsole

Basically, you just need to d/l and unzip RunHiddenConsole to your nginx directory, then change this line to:

RunHiddenConsole.exe php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini


You're looking for

start php\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php\php.ini /exit b


To run a .BAT Invisible you can use a simple vbs script.

Put this in a .VBS file :

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

And then run your BAT like this :

wscript.exe "C:\invisible.vbs" "C:\YourBat.bat"