Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var php = {
- cmd : function(command, nWindowType){
- // Obtain a Temporary File Name
- var oFS ;
- var RunOutput = '' ;
- oFS = new ActiveXObject("Scripting.FileSystemObject");
- var cFile ;
- cFile = oFS.GetSpecialFolder(2).Path+'\\'+ oFS.GetTempName() ;
- // Execute the command and redirect the output to the file
- var oShell ;
- oShell = new ActiveXObject("WScript.Shell");
- oShell.Run(command + " >" + cFile, nWindowType, true);
- oShell = null ;
- // Read output file and return
- var oFile ;
- oFile = oFS.OpenTextFile(cFile, 1, true) ;
- RunOutput = oFile.ReadAll() ;
- oFile.Close() ;
- // Delete Temporary File
- oFS.DeleteFile(cFile);
- oFS = null ;
- cFile = null ;
- return RunOutput ;
- }
- }
- // output = php.cmd('command /c php -v ', 0);
Add Comment
Please, Sign In to add comment