The reason is that when you use echo
function PHP HAVE to send headers to the client, so any subsequent header will NOT be sent.
To correct that either you remove the echoes
(as client won't see them) or you remove the header()
and add a JavaScript that does the redirect.
Edit:
As Dave Chen stated, you shouldn't have that whitespace between the script outside the <?PHP
tag as it is sent to the client (again, with headers).
To do what you are asking, do the script that way :
<?php
exec('c:\WINDOWS\system32\cmd.exe /c START C:\Users\Administrator\Desktop\VGBR\steamapps\common\GarrysModDS\Start.bat > NUL');
header('Location: /done.php');
die();
?>
EDIT 2
If the PHP keeps hanging, it is because it is waiting that .bat app to return something. In that case, check the following StackOverflow questions:
php exec command (or similar) to not wait for result
Running a PHP "exec()" in the background on Windows?