Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8771445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:47:24+00:00 2026-06-13T17:47:24+00:00

I’ve got an interactive command line program that we’ll call program.exe. While it’s running,

  • 0

I’ve got an interactive command line program that we’ll call program.exe. While it’s running, I can type in a bunch of different commands that do different things. We’ll call them: doA, doB, doC, and quit. Now, as it turns out, the first thing I want to do in program.exe is always doA. I’d like to save a few keystrokes and automatically have program.exe run the command doA upon startup. Unfortunately, I can’t just pass “doA” on the command line because whoever created program.exe didn’t implement that feature.

The way I see it, I have a few options:

  • Write another program that calls program.exe, writes doA to its stdin, then hooks it’s own stdin to program.exe’s stdin and hooks program.exe’s sdtout to it’s own stdout. This will probably work, but I’d like to see if there’s a solution that doesn’t require a compiler

  • Use some batch file magic to jam doA into program.exe’s stdin. This is the part that I’ve got questions about. Here’s what I’ve tried so far:

echo doA | program.exe

This works, in that program.exe executes doA, but then I can’t type any other commands to program.exe. Echo is hogging up program.exe’s stdin

more | echo doA | program.exe

This also works and gets a little closer to what I’m after. program.exe executes doA and I see the output from doA. I can also type in additional commands, but I don’t see the output from these commands. Furthermore, when I send the quit command, program.exe terminates (I guess), but I’m still stuck in the “more” command and I can keep typing lines until I hit ctrl+c.

The Question: Is there another way to do what I’m trying to do with a bat file? Conceptually, I think I need to combine two streams (the keyboard, and the literal “doA”) into one and pass that into program.exe, but I could be way off.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:47:25+00:00Added an answer on June 13, 2026 at 5:47 pm

    First, more | echo doA | program.exe does not do what you think it does.
    After sending doA echo does not connect those pipe stages together, it rather creates perfect sink – that’s why you do not see your commands echoed. They go nowhere and are not executed by program.exe. I don’t think there is a simple way to achieve what you want directly from command line, but it can be easily resolved by using small batch file. Create a batch file, say args.bat:

    @echo off 
    echo First command
    more
    

    Now run your program by args|program.exe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I've tracked down a weird MySQL problem to the two different ways I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.