Previous Next

Thread: Why I can't exec batch file? ???

Last post 05-06-2008 12:32 PM by anilr. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 05-05-2008, 11:38 PM

    • toeh101
    • Not Ranked
    • Joined on 04-21-2008, 8:48 AM
    • Posts 3
    • toeh101

    Why I can't exec batch file? ???

    Hi,
    I've tried to use PHP exec() to execute DOS command.
    It works with command exec("md example_dir") .
    But when I put test.bat in same directory and run PHP with exec("test.bat") , it doesn't work. No error showed but not work.

    Anyone can help me?

    Thanks.

  • 05-06-2008, 10:29 AM In reply to

    • brashquido
    • Top 25 Contributor
    • Joined on 05-22-2006, 12:31 AM
    • Australia
    • Posts 148
    • IIS MVPs
    • brashquido

    Re: Why I can't exec batch file? ???

    You'll need to specify that you wish to use the Windows command line to execute your batch file. Have you tried something like exec("cmd.exe /c test.bat") ?

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 05-06-2008, 12:32 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 872
    • anilr

    Re: Why I can't exec batch file? ???

    Also, the current working directory of the php process (in the fastcgi case) is not the application/vdir root, but the directory from where php is run, so use a fully qualified path.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (3 items)
Page view counter