Windows Batch Scripts - Printable Version +- Linux-Noob Forums (https://www.linux-noob.com/forums) +-- Forum: Windows Noob (https://www.linux-noob.com/forums/forum-5.html) +--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-70.html) +--- Thread: Windows Batch Scripts (/thread-2266.html) |
Windows Batch Scripts - hybrid - 2006-01-06 OK, here's a bit of background on what I'm trying to do. I need to show someone a PHP/MySQL powered website (built and tested in Linux) without uploading to a server. The only system I can get to is a laptop running Windows XP Pro, and I don't want to boot a live Linux distro. I have installed Apache/PHP/MySQL on this laptop and they are talking to each other OK. What I want to build is a short batch script that will start MySQL, and then Apache and then launch a browser to view automatically without fumbling around in the CLI. I am running Apache *not* as a service. Here is my code so far: Code: @echo off The problem is, the line Code: "C:\Program Files\Apache Group\Apache2\bin\apache.exe" just causes the script to hang, as Apache is running in the same CMD window. Is there a way like Bourne Shell's & to run it in the background? I have tried using the start command, but it doesn't seem to start the server properly. Output of the script: Any help would be appreciated, (PS - IE isn't my choice ;) ) Windows Batch Scripts - anyweb - 2006-01-06 use a separate batch script to start apache, and call that script from within the first one such as Code: @echo off start_apache. bat could simply be like so Code: echo. cheers anyweb Windows Batch Scripts - hybrid - 2006-01-07 This didn't work, because once again the script start_apache.bat doesn't end until Apache terminates - and Apache only terminates when it is manually killed. I worked out how to do it though, apparently the start command takes the window title of the new window as the first argument and the command second (how intuitive o_O ), so when i ran: Code: start "C:\Program Files\Apache Group\Apache2\bin\apache.exe" I was simply creating a blank command window with the title of C:\Program Files\Apache Group\Apache2\bin\apache.exe, that didn't run anything, so changing the line to: Code: start "Apache (do NOT close until finished)" "C:\Program Files\Apache Group\Apache2\bin\apache.exe" sets the title of the window to Apache (do NOT close until finished), and then actually runs the command inside that new window. Thanks for the help anyway, anyweb. :) |