Okay, so I've taken over this project and I need help understanding a batch-file while also rewriting it a little. The batch-file contains only these three lines:
@echo off
start php/php.exe -S 127.0.0.1:80 -t drawtool
start "" http://127.0.0.1
I understand the first line, which basically hides the command prompt from view. I might not fully understand the last line, but I'm guessing that it starts up my default browser and opens up the localhost-address.
The second line however, I have no idea what -S or -t are. Usually I would just google this, but I've really tried for hours. I simply can not find anything out about these dash-commands followed by letters.
Another thing about the second line I do not understand is why the word 'drawtool' is written at the end.
I'll try to elaborate the project's directory tree that the batch-file interacts with. It starts out with a folder named InputTool. The InputTool contains a few subdirectories, which I'll explain below:
InputTool (parent folder #1)
DrawTool (folder)
index.php
php (folder)
php.exe (executable file, I'll get back on this)
additional ddl- & configuration-files
start.bat (this is the batch file that I have trouble understanding)
What I want to do is to move the php folder & the batch file outside of their parent folder (one level up). So that they're now in the same directory as the InputTool folder. And I'd want the batch file to still work properly after that, while also understanding what -S, -t & how the structure of the second line works.
@echo off
Yes, as you guessed this hides the commands from the command prompt.
start php/php.exe -S 127.0.0.1:80 -t drawtool
This line starts PHP which is the executable php.exe
in folder php
. It will launch a PHP web server on localhost port 80 (option -S
). Based on the PHP manual, option -t
specifies the document root for built-in web server. So it will execute scripts (aka index.php) inside this folder (drawtool).
start "" http://127.0.0.1
And finally, yes this opens your default navigator to the address of the server.
So basically, to answer your second question, as all paths here are relative, the batch file should still work as long as php.exe
stays at the same place relative to start.bat
, or if you edit the paths correctly.