dos batch file execution

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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\batch.bat');

as a starting point.

Can anyone point me in the right direction please?


Re: dos batch file execution

Quoted text here. Click to load it

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,
Providenza & Boekelheide, Inc.

Re: dos batch file execution

Tim Roberts wrote:

Quoted text here. Click to load it

echo system("\server\share$\dir\batch.bat arg1");


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

both don't return anything.

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

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!).

Site Timeline