Invoke scripts using shell_exec and Windows?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Invoke scripts using shell_exec and Windows?

Post by alex.barylski »

I have a command for some custom binaries, running on Windows. When I invoke the command throuh cmd.exe manually, everything works as expected, however I cannot get a simple mkdir to work:
command = "mkdir.exe C:\WINDOWS\temp\alextest";
system($command);
No errors, nothing.

I have tried system, shell_exec, exec, etc with no results...what am I missing?

Cheers,
Alex
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Invoke scripts using shell_exec and Windows?

Post by requinix »

mkdir is not a program - it's a command supported by cmd.exe. system() can only run actual executables.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Invoke scripts using shell_exec and Windows?

Post by alex.barylski »

OK but I'm not actually using mkdir I'm using htmldoc which is a command and I still get nothing when invoked through shell_exec. Any ideas? Works fine on Linux, I'm using the Windows binary.

Cheers,
Alex
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Invoke scripts using shell_exec and Windows?

Post by Eran »

Seems obvious, but are you using the full path to the executable?
Post Reply