Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Procedure.s ExecuteCmd(sCommand.s)
  2.  
  3.   cmdPath.s = Space(#MAX_PATH)
  4.   GetSystemDirectory_(@cmdPath, #MAX_PATH)
  5.   cmdPath + "\cmd.exe"
  6.  
  7.   sResult.s = ""
  8.  
  9.   If FileSize(cmdPath) > 0
  10.     cmd = RunProgram(cmdPath,"/C " + sCommand, GetPathPart(cmdPath), #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
  11.  
  12.     If cmd
  13.       While ProgramRunning(cmd)
  14.         If AvailableProgramOutput(cmd)
  15.           sResult + ReadProgramString(cmd) + #CRLF$
  16.         EndIf
  17.       Wend
  18.     EndIf
  19.   Else
  20.     sResult + "cmd Was not Found!!! ERROR!!!!"
  21.   EndIf
  22. ProcedureReturn sResult
  23. EndProcedure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement