Page 1 of 1

Get Output from PaExec

Posted: Mon Apr 13, 2020 1:58 pm
by tatanas
Hi,

I can't get any stdout/stderr from PaExec (equivalent to PsExec). I can't find any information on the internet if it's possible.
Can someone test this code ?

Code: Select all

p=RunProgram("paexec.exe", "-i -d calc", "", #PB_Program_Hide|#PB_Program_Open|#PB_Program_Read|#PB_Program_Error)

If p
	While ProgramRunning(p)
		If AvailableProgramOutput(p)
			o$+ReadProgramString(p)+#CRLF$
		EndIf
		
		err$ = ReadProgramError(p)
		If err$
			o$+"<ERR> " + err$ +#CRLF$
		EndIf   
	Wend
	CloseProgram(p)
EndIf
MessageRequester("Output",o$)

Re: Get Output from PaExec

Posted: Sat May 30, 2020 1:00 am
by JHPJHP
Hi tatanas,

I’ve added a new example to my Windows Services & Other Stuff:
- \Other_Stuff\OtherStuff\CommandConsole\ReadOutput.pb

NB*: Based on work I did in Alternate Console; recently updated.

Re: Get Output from PaExec

Posted: Sat May 30, 2020 1:55 am
by BarryG
Thanks JHPJHP, that works perfectly for me. Weird that the simple short code by tatanas doesn't capture it; looks like a bug. I've reported it.