Page 1 of 1
[Resolved]Capturing EXEC output
Posted: Mon Aug 09, 2021 10:23 am
by nemesis
Hi,
as the title says I want to capture the output os a command run with EXEC in a tbsscript for obvious reasons.
How would i go about this?
Regards,
Davy
Re: Capturing EXEC output
Posted: Mon Aug 09, 2021 8:41 pm
by TeraByte Support(PP)
If you can redirect to a file you could read that back in and process it. For example, 'dir' output:
Code: Select all
sub main()
r = exec("cmd.exe /c dir >dirout.txt",1)
printl("^n^nResult code: " # r)
printl("^n^n-----------------------")
printl("Contents of dirout.txt:")
printl("-----------------------")
f = open("dirout.txt", "uin")
s = readl(f)
while (s<>"")
print(s)
s=readl(f)
wend
close(f)
end sub
Re: Capturing EXEC output
Posted: Tue Aug 10, 2021 9:48 am
by nemesis
Hi Paul,
not the most elegant solution but it'll serve my purposes, thnx.