Guest User

Untitled

a guest
Apr 25th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. var php = {
  2. cmd : function(command, nWindowType){
  3. // Obtain a Temporary File Name
  4. var oFS ;
  5. var RunOutput = '' ;
  6. oFS = new ActiveXObject("Scripting.FileSystemObject");
  7. var cFile ;
  8. cFile = oFS.GetSpecialFolder(2).Path+'\\'+ oFS.GetTempName() ;
  9.  
  10. // Execute the command and redirect the output to the file
  11. var oShell ;
  12. oShell = new ActiveXObject("WScript.Shell");
  13. oShell.Run(command + " >" + cFile, nWindowType, true);
  14. oShell = null ;
  15.  
  16. // Read output file and return
  17. var oFile ;
  18. oFile = oFS.OpenTextFile(cFile, 1, true) ;
  19. RunOutput = oFile.ReadAll() ;
  20. oFile.Close() ;
  21.  
  22. // Delete Temporary File
  23. oFS.DeleteFile(cFile);
  24. oFS = null ;
  25. cFile = null ;
  26. return RunOutput ;
  27. }
  28. }
  29.  
  30. // output = php.cmd('command /c php -v ', 0);
Add Comment
Please, Sign In to add comment