# How to pass variable data into Shell command (Windows)

**URL:** <https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443>\
**Category:** General\
**Created:** [June 29, 2017, 7:58am UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443 "2017-06-29T07:58:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![changwon\_lee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@changwon\_lee](https://forum.xojo.com/u/changwon_lee)\
**Post date:** [June 29, 2017, 7:58am UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443/1 "2017-06-29T07:58:57Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![changwon\_lee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@changwon\_lee](https://forum.xojo.com/u/changwon_lee)\
**Post date:** [June 30, 2017, 12:57am UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443/2 "2017-06-30T00:57:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [June 30, 2017, 7:04am UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443/3 "2017-06-30T07:04:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Kono](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/a9adbd/32.png) [@Michael\_Kono](https://forum.xojo.com/u/Michael_Kono)\
**Post date:** [June 8, 2020, 11:37pm UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443/4 "2020-06-08T23:37:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:49pm UTC](https://forum.xojo.com/t/how-to-pass-variable-data-into-shell-command-windows/38443/5 "2020-10-29T18:49:40Z")

</div>


