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
[Resolved]Capturing EXEC output
[Resolved]Capturing EXEC output
Last edited by nemesis on Fri Aug 27, 2021 8:28 am, edited 1 time in total.
-
- Posts: 1682
- Joined: Fri Aug 12, 2011 12:51 am
Re: Capturing EXEC output
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
Hi Paul,
not the most elegant solution but it'll serve my purposes, thnx.
not the most elegant solution but it'll serve my purposes, thnx.