johnmahugu

php - execute command

Jun 25th, 2015
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <a href="index.php">Go back to index</a>
  2. | <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
  3.  
  4.  
  5. <title>Execute command</title>
  6. <h1>Execute command</h1>
  7.  
  8. <pre style="background:#ddd">
  9. // Execution of commands may hang on Windows XP for some programs,
  10. // wmic.exe is one of them. The solution is to use a command like
  11. // this "echo | command...".
  12.  
  13.  
  14. $output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
  15.  
  16. if ($output) {
  17.     echo "Command executed successfully.&lt;br&gt;";
  18.     echo "Output: $output";
  19. } else {
  20.     echo "Command failed.";
  21. }
  22. </pre>
  23.  
  24. <?php
  25.  
  26. // Execution of commands may hang on Windows XP for some programs,
  27. // wmic.exe is one of them. The solution is to use a command like
  28. // this "echo | command..."
  29.  
  30. $output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
  31.  
  32. if ($output) {
  33.     echo "Command executed successfully.<br>";
  34.     echo "Output: $output";
  35. } else {
  36.     echo "Command failed.";
  37. }
  38.  
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment