www.webdeveloper.com
Results 1 to 6 of 6

Thread: running batch file through php

  1. #1
    Join Date
    Apr 2010
    Posts
    16

    Angry running batch file through php

    hi,

    i am having a code to run a batch file, the batch file is running well but my browser get hanged and does not run the next line of code after EXEC function:

    <?
    exec("f:/upload.bat");

    echo "done";
    ?>

    exec () runs properly but it does not go to next step to echo.

    please suggest any solution
    thanks in advance

  2. #2
    Join Date
    Jan 2004
    Posts
    484
    the batch will be run on the server.

    not on the clients machine if you need to run the batch on the clients machine then you will need to have the client down load it and manually run it.

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    You might try proc_open or popen

  4. #4
    Join Date
    May 2012
    Posts
    1
    I am trying to execute .bat file using IIS 7, PHP 5.3 on 2008. I use this code in my vbs.php, exec(cmd /c password.bat); When I run the page it freezes, but if I take comment it out it loads just fine. Does anyone know why ?

  5. #5
    Join Date
    May 2012
    Posts
    59
    Whats in the batch file? If the batch file has any prompts or anything that requires human intervention... then it wont return control back to PHP and will freeze.

    Kind regards,
    Scott

  6. #6
    Join Date
    May 2012
    Posts
    59
    You may also want to look at using either of these as i'm not entirely sure on what your aim is but i'm sure you can decide if they better suit your requirements:
    http://www.php.net/manual/en/function.passthru.php
    http://www.php.net/manual/en/function.system.php

    Kind regards,
    Scott

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles