Hello all. Been looking for a couple days on this, so thought I would try this forum. I am trying to run some programs on a local server using php and IIS on windows XP. What I really need to do is execute programs WITH PARAMETERS in flash but flash doesn't allow that so I thought I would try php as the middleman. Anyway, it DOES load a program, but not for the current user. When I test this:
shell_exec ("C:/windows/notepad.exe");
I don't see the notepad open, but if I check the tast manager there is a notepad.exe process in there and it is running under "System" for the username. I've tried changing IIS to use my current login under the DIRECTORY SECURITY tab but it doesn't seem to make a difference.
Anyone know a solution to my problem? Thanks for any input.
-Shawn
shell_exec to run program in foreground on windows
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
You shouldn't have to use the full path, because notepad by default is included in the system path.
Also because you don't close STDIN, STDOUT, STDERR, the page will hang until you close notepad. You can only close it via COM or .NET by killing the process or by opening and closing notepad as an $object = new COM ( 'app.id'); If your needing interaction then use PHP WIN32 or use the COM interface.
pif
Code: Select all
<?php
system ( 'notepad.exe' );
?>pif
Code: Select all
<?php
sell_exec('notepad "your arguments here"');
?>Thanks for the help. So far any methods with or without still open notepad as is seen in task manager, but still is under the user "system" so not visible to the user. I'm not really needing to open notepad in my program, but just using it as a test. I have have tried a few different ways to do this but nothing I can use just yet. See, flash does have an option to execute a program, but with many limitations including not being able to give it params. I can successfully open a program with a .vbs script or a batch file and have it shown in the foreground, but I can only send parameters to a .asp or .php script from flash. When trying to use .php or .asp to open programs they always show up under another user in task manager. The program I need to open will need many different commands so I cannot write a .vbs or shell script for each possible combination of parameters as it would be too many.
If I can't get this to work the only other option I can think of is have a .php or .asp script create a batch file and then have flash open this file after it is created. This just seems like a very crappy way of doing this though.
If I can't get this to work the only other option I can think of is have a .php or .asp script create a batch file and then have flash open this file after it is created. This just seems like a very crappy way of doing this though.
It's going to run locally, this computer won't even be connected to the internet. I want to make a game selector that has some cool animations and stuff, and I can do everything I want with a flash projector file except for starting the programs. Of course I could start them in a C..something program but I know flash Much Much better and don't have time to learn just for this little project...