shell_exec, batch files, and IIS on Windows - PHP

This is a discussion on shell_exec, batch files, and IIS on Windows - PHP ; The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that ...

+ Reply to Thread
Results 1 to 2 of 2

shell_exec, batch files, and IIS on Windows

  1. Default shell_exec, batch files, and IIS on Windows

    The manual entry for shell_exec has a comment that notes to execute .bat
    files with shell_exec, you need to pass the command through cmd.exe with
    the /c argument. I was wondering if anyone could share some insight on
    why that is.

    I've pretty much verified that this is the case. I can't execute .bat
    files at all from a Windows 2003 server running IIS. I can locally on
    my development workstation (XP running Apache). I've tried passing the
    command through cmd.exe on the server, but some of the commands in the
    ..bat file does not run properly when going through cmd.exe.

    I suspect that IIS is a key culprit, but I have nothing concrete. I'd
    like to take a plausible theory to the IT guys before I request that
    they install Apache on that box.

    Thanks for any insight anyone might have.

  2. Default Re: [PHP] shell_exec, batch files, and IIS on Windows

    On Tue, February 27, 2007 2:59 pm, Shu Chow wrote:
    > The manual entry for shell_exec has a comment that notes to execute
    > .bat
    > files with shell_exec, you need to pass the command through cmd.exe
    > with
    > the /c argument. I was wondering if anyone could share some insight
    > on
    > why that is.
    >
    > I've pretty much verified that this is the case. I can't execute .bat
    > files at all from a Windows 2003 server running IIS. I can locally on
    > my development workstation (XP running Apache). I've tried passing
    > the
    > command through cmd.exe on the server, but some of the commands in the
    > .bat file does not run properly when going through cmd.exe.
    >
    > I suspect that IIS is a key culprit, but I have nothing concrete. I'd
    > like to take a plausible theory to the IT guys before I request that
    > they install Apache on that box.
    >
    > Thanks for any insight anyone might have.


    No real insight, but a couple philosophical questions that may lead
    somebody who actually does Windows into something...

    When one runs a .bat file, isn't one already *IN* some kind of cmd.exe
    shell of some type to start with?

    OTOH, what is PHP doing with exec() on Windows if not firing up some
    kind of cmd.exe shell?

    You could run a test with Apache/Windows/exec fairly quickly on any
    box, without hitting the IT guys up with the request. Have proof in
    hand that IIS is culprit and Apache is saviour. :-)

    --
    Some people have a "gift" link here.
    Know what I want?
    I want you to buy a CD from some starving artist.
    http://cdbaby.com/browse/from/lynch
    Yeah, I get a buck. So?

+ Reply to Thread