not seem to getting the outputs from exec() command in PHP, OS: Windows XP
here’s the code used:
exec(“echo %username%”,$output);
using print_r($output) which returns 1;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
echois not a program on Windows that you can call. It is a feature provided specifically by the command processor (i.e.cmd.exe).If you want the username in this manner don’t start up a shell. Use
getenvinstead.(If for some reason you wanted to use
echoyou would need to docmd.exe /c echo Whatever. Also note that checking the return code as well as the output may be useful)