How to run interactive commands in another application window from powershell

Question:

I have another command line program which I invoke from my powershell script and would like to run some interactive commands in that window once it is opened from power shell.

In other words – I do a Invoke-Item $link_to_app which opens up the interactive command line for that application and now I would like to use the application specific commands from within powershell scripts.

e.g. app.exe -help to invoke the help command of the app.exe.

Any pointers would help. Thanks!

Answer:

Try this:

Tested with this and it worked as expected:

From your expanded explanation you appear to want to run 2 commands within the same command prompt. This is possible, however, I’m not sure it will work in your scenario. For example:

test1.bat:
echo "hello!"

test2.bat: echo "goodbye!"

output:

Hope this helps.

Source:

How to run interactive commands in another application window from powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply