﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Programming / Powershell  / How to pass a response to a .exe called by PoSh / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 00:45:33 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>Good deal. Thanks for posting back that it was sorted.</description><pubDate>Thu, 14 Feb 2013 08:05:32 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>Yeah, I know it's a cmd hack, and you're right, it'll only work for a single response.In my particular case, that's all that would have been required.I got around it per your suggestion by using another switch.Thanks!P</description><pubDate>Thu, 14 Feb 2013 07:46:40 GMT</pubDate><dc:creator>schleep</dc:creator></item><item><title>RE: How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>That's not a PowerShell thing per se. What that is saying is:echo textToPipeIn | executableName executableOptionsWhich works fine in cmd Shell as well. How to pipe in more than one answer with that syntax though?</description><pubDate>Thu, 14 Feb 2013 07:35:06 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>Hmmmmm.I found this on the net; the author plainly states it's a bit of a hack, but also claims to have made it work for him. I've not been able to get this to work myself.#Pass the Y and exit  $PlinkCommand  = [string]::Format('echo y | &amp; "{0}" {1} exit',   $PlinkAndPath, $plinkoptions )  Write-Host $PlinkCommand  $msg = Invoke-Expression $PlinkCommandWhere $PlinkAndPath is path to .exe, and$plinkoptions are the parameters (username, password, hostname, etc)</description><pubDate>Thu, 14 Feb 2013 07:08:47 GMT</pubDate><dc:creator>schleep</dc:creator></item><item><title>RE: How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>I think that is up to the program being called not PowerShell. If the program wants to accept input interactively and does not provide an input parameter for the information or a way to provide an "answer file" then I am not sure you can get around that.</description><pubDate>Wed, 13 Feb 2013 15:33:59 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>How to pass a response to a .exe called by PoSh</title><link>http://www.sqlservercentral.com/Forums/Topic1419634-1351-1.aspx</link><description>I'm calling an command line .exe from within a PoSh script. This is generating a hit Y for Yes / N for No choice. How can I send a Y in my PoSh script?Thanks!</description><pubDate>Wed, 13 Feb 2013 09:59:54 GMT</pubDate><dc:creator>schleep</dc:creator></item></channel></rss>