Echo Data to Powershell

Background

Trying to automate a little app.

As Powershell is a modern development tool and I do not need to compile the source code wanted to try it out first.

Exercise

Our need is very narrow.

The app is requesting that we enter our full name.

Really did not want to engage with the app so intimately and will rather feed its input through another channel.

Code

Powershell


$fullname = Read-Host -Prompt 'Please enter first and last name'

$line = "The name you entered is {0}" -f $fullname

Write-Host $line

CommandShell


@echo off

setlocal

    set "_fullname=Daniel Adeniji"

    set "_app=acceptKeyStroke.ps1"

    echo %_fullname% | powershell -f %_app%

endlocal

Output

echoToPowershell_20181025_0810AM.PNG

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s