0

I am trying to call a executable file as follows

.\test_use.exe

then I press the return key to get a interface like

"Enter a value between 1 and 5"

I type 4 and get some details. Is there a way to automate it via powershell. I tried passing

.\test_use.exe 4

But it does not work. I also tried

$input = "4"
Invoke-command ".\test_use.exe" -InputObject $input

I get the following error

Invoke-command: Parameter cannot be resolved using the specified named characters

Does anyone have any pointers ?? Will it be easier to do this in batch file and store the output in a text file?

Mark
  • 3,609
  • 1
  • 22
  • 33
LGG
  • 528
  • 9
  • 21
  • You may be interested in the WASP ( **W** indows **A** utomation **S** nap-In for **P** owershell) project over at [http://wasp.codeplex.com](http://wasp.codeplex.com). It allows for window manipulation similar to what you are referring to I believe. – TheMadTechnician Apr 22 '14 at 22:57

1 Answers1

1

In batch you might be able to do the following:

(echo 4) | test_use.exe

See this question - how to pass input to .exe in batch file?

Community
  • 1
  • 1
unclemeat
  • 5,029
  • 5
  • 28
  • 52