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?
.



Relevant Pages

  • Re: What is the difference between CMD and BAT file ?
    ... BAT will not cause error message for commands like ... NOT be listed under non NT i.e. Windows 9x, Me, etc. ... typed in a Command Prompt or the Run command. ... File Extension .cmd ...
    (microsoft.public.windowsxp.general)
  • Re: .Bat files
    ... and specifically at the section on the command "chmod" gives them the ... and the example command I gave ... above would try to make all files that end with ".bat" [in your current ... think a good book on shell "scripting" would go a lot further than the man ...
    (alt.os.linux.suse)
  • Re: How to run a batch file or VBS from Access VBA code?
    ... IIRC to run a .bat or .cmd file you must invoke the Windows command ... >>>Even reproducing the functionality of the batch files may be possible in VBA. ... >I inherited a series of old ftp bat files, but I find it cubersome to use ...
    (microsoft.public.access.modulesdaovba)
  • Re: Launch a .bat file with VBA
    ... Maybe when you run the .bat, it expects the files that it works on to be in the ... you can add commands to go to that drive and folder to the top of the ... Once the shell command is executed, ...
    (microsoft.public.excel.programming)
  • Re: do I need an URL Scan for IIS 6.0 ??
    ... I have some IIS 4 and 5 and eatch IIS has an URL Scan installed. ... extentions like .bat!! ...
    (microsoft.public.inetserver.iis.security)