dos batch file execution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hughie

    dos batch file execution

    Has anyone done this? A windows webserver has a share on the same
    computer that contains some dos batch files. I'm trying to write a
    php page that will execute them. After much thrashing around and
    searching I'm still not getting any results.

    I've tried
    echo exec('t:\dir\ba tch.bat');

    as a starting point.

    Can anyone point me in the right direction please?

    Hughie

  • Tim Roberts

    #2
    Re: dos batch file execution

    "hughie" <hughie.carroll @gmail.comwrote :
    >Has anyone done this? A windows webserver has a share on the same
    >computer that contains some dos batch files. I'm trying to write a
    >php page that will execute them. After much thrashing around and
    >searching I'm still not getting any results.
    >
    >I've tried
    >echo exec('t:\dir\ba tch.bat');
    >
    >as a starting point.
    The problem is probably the "t:", not the batch file. The webserver runs
    as a service, under a separate user name, that does not have access to your
    net shares.

    Try writing it as a UNC: \\server\share\ dir\batch.bat.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    • hughie

      #3
      Re: dos batch file execution


      Tim Roberts wrote:
      Try writing it as a UNC: \\server\share\ dir\batch.bat.
      echo system("\\serve r\share$\dir\ba tch.bat arg1");

      or

      echo exec("\\server\ share$\dir\batc h.bat arg1");

      both don't return anything.

      now playing with adding "cmd /c " before my string.

      Comment

      • hughie

        #4
        Re: dos batch file execution


        I now believe this is a permission issue. php running on windows under
        an IUSR account probably without permissions to access cmd.exe (which
        is good!).

        Comment

        Working...