Can't run the Nginx executable file


I’ve installed Nginx web server on my machine under Windows 7 with php.

When I start the “nginx.exe”, the command prompt opens for a second and then closes automatically, so I can’t control it through the command prompt. Couldn’t find a solution anywhere.

What I want is to open the “nginx.exe” and use various commands there.

Otherwise the server is working.


  1. First you need to know the path to your nginx.exe file.

  2. Once you have that right click on your desktop and click on the new text document.

  3. Then type or paste in the following text:

cd c:\nginx
start nginx.exe
cmd /k
  1. Now save the file with whatever name you want to use but add the .bat extension to it. Example nginx.bat

  2. Now you can click on the file and it should open the command prompt, change the directory, start the server, and then leave the prompt open in the correct directory so you can run your commands.

Answered By – Larry Lane

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published