Thanks for your reply.
Just tried the code you gave me, unfortunatly it waits the time but the command isn't being run and it doesn't display anything once it's finished.
Any other ideas?
thanks again.
Main Topics
Browse All TopicsHello.
I'm trying to make use of the exec feature in PHP. I'm trying to run the following command:
C:\psshutdown.exe @c:\shutdown.txt -u administrator -p password -t 60 -f -k -c -m "This PC Will Blow Up In 60 Seconds! Run You Fool!?"
The above command works prefectly in the command line, so i put together the code in the code snippet, although when i run it, it just 'thinks' for about 10 seconds then finishes, but the command isn't working. There is nothing output from '$output' and if i print '$return_var' it shows '-1073741502'.
i tried running a process manager to see what it was running and got these results:
http://img148.imageshack.u
It appears to show that it's run it, but it hasn't. I've noticed that it closed cmd very quickly after the command was run, perhaps not being it enough time to run?
Anyone have any suggestions why it's not working?
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I have only one more idea.
Create a batch file called "psshut.bat" and put it here:
C:\psshut.bat
The batch file should contain one line only:
C:\psshutdown.exe @c:\shutdown.txt -u administrator -p password -t 60 -f -k -c -m "This PC Will Blow Up In 60 Seconds! Run You Fool!?"
Then exicute the batch file from PHP:
<?php
$command='C:\psshut.bat';
echo shell_exec($command . ' 2>&1');
?>
If that does not work, I cannot help.
What you are trying to do could be considered dangerous from a security standpoint. It is possible that a firewall or some other security software is preventing you from doing this. Beyond that, I am sorry, without a specific error message I am shooting in the dark.
Business Accounts
Answer for Membership
by: hankknightPosted on 2008-10-31 at 02:51:44ID: 22848595
To see the acual command-line error, you should add 2>&1 to the end of your command.
Also, you are sleeping for only 10 seconds, and I think you will need to sleep fore more than 60.
Select allOpen in new window