How to pass variable data into Shell command (Windows)

Through a SSH session to a remote Linux server, I receive some text result and save it into a local variable as following.

Dim SSH_result as string 

// SSH processing
// .............................

SSH_result = BufferString

At this time, I use a Xojo Shell to run ‘psql’ command for loading the text data into PostgreSQL database.
If my current data (BufferString) is created with a file, I could use below code by using a shell which passes the file data through STDIN.
Created file: remoteLinux_ssh_get_result
cat remoteLinux_ssh_get_result | psql -f event.sql

However, I want to use BufferString directly without creating a file. As there are so many sub-jobs doing this stuff at the same time, so I wanted to remove the logic which creates files locally in Windows.

Can you advise me if there is any way to pass BufferString into Shell command? Means that way to use BufferString data in Shell object.

Thanks in advance.

My bad.
I am thinking of saving BufferString data directly into PostgreSQL database with CODE instead of using a shell and ‘psql’ command.
Very simple one. I thought it very seriously so something important and simple one was ignored. Basic matters.

Thanks.

Anything the shell prints to stdout can be read by your Xojo program. Echo BufferString to stdout and capture it in Xojo.

I have been looking for a way to execute a psql \copy command to a cloud hosted Postgresql server from within Xojo app. Your post from 3 years ago implies you were able to execute psql commands from within Xojo. Could you share some example on how to do this?