1.

Solve : how to set input parameter in batch?

Answer»

Hey all,

I'm wondering if there is a way to set INPUT parameters up in a batch script. Here's the general idea as output of the application:

Code: [Select]C:\USERS\***\Documents>interactiveConsoleApp
$>SOMETHING
doing something...
$>something else
doing something else...
$>quit
C:\Users\***\Documents>

What I want to do is create a batch script that would pass those parameters ("something" and "something else") into the application. Is this possible?
You mean you have a program that takes input parameters from the command line and you want to do it from a batch file?

Like this?
Quote



Breakfast.exe eggs cheese ham

Lunch.exe steak potatoes "apple pie"


That sort of thing?

No these are not parameters that would be called as arguments for the application. Maybe a good example would be the MySQL command line tool, where you ENTER a few parameters initially, but you can do multiple SQL statements within the tool itself. Here's another example:

Code: [Select]C:\Users\***\Documents>consoleApp -u=username -p=password

$>call method in consoleApp
method was called

$>obtain network rights
rights obtained

The lines where I obtain network rights or call method in consoleApp wouldn't be called as arguments to the application, but would be interaction the USER takes typically after the application is running.OK I'm with you. Like telnet, where you open a console? there is no generic way of doing this.

You could try a pipe which works with some programs but not others

echo command1 > myfile.txt
echo command2 >> myfile.txt
echo command3 >> myfile.txt
echo quit >> myfile.txt

type myfile.txt | consoleApp -u=username -p=password

Something like that, although I have a feeling that the username and password stuff might get in the way, but you could experiment.





Discussion

No Comment Found