S
S
Sanchoys2282020-08-05 20:33:39
cmd/bat
Sanchoys228, 2020-08-05 20:33:39

How to open a program with a batch file and set data in it?

How to write a .bat file that will open a program (python program, interface in the console) and enter the data I need into it.
The program has several functions that open when you write the desired number (number of functions).
The batch file should open the program and write, for example, the number 5.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
SKEPTIC, 2020-08-05
@pro100chel

Read about what the batch file does and why it is needed at all. Also read about passing Python arguments to a script via the command line.
Here no one will write the code for you.

R
res2001, 2020-08-05
@res2001

You fill in the input information into a text file, then you redirect this file to the stdin of your program:
python myscript.py <file.txt

W
wisgest, 2020-08-06
@wisgest

The batch file must open the program and write, for example, the number 5

echo 5| python script.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question