0

In order to run python from cmd file I need only to run:

python file_name.py

In order to add a timeout, as suggested here we should only do something like that:

timeout time_in_secs python file_name.py

But how to run a python with args, something like that?

timeout time_in_secs python file_name.py --cli_arg="cli_arg"
user1452221
  • 124
  • 2
  • 9
  • 2
    The [`timeout` command](https://ss64.com/nt/timeout.html) in Windows is nothing but an equivalent to `sleep`, hence it waits for a certain amount of time; to kill the Python process after a certain amount of time you will have to write a script (probably using [`start`](https://ss64.com/nt/start.html) to parallelly run the Python task, [`tasklist`](https://ss64.com/nt/tasklist.html) to identify the correct task and to get its identifier, [`timeout`](https://ss64.com/nt/timeout.html) to await the timeout and [`taskkill`](https://ss64.com/nt/taskkill.html) to eventually kill the task)… – aschipfl Sep 22 '20 at 09:11
  • 2
    The question and answer in your provided link, was specific to the `B`ourne `A`gain `SH`ell, not `cmd.exe`. – Compo Sep 22 '20 at 09:30

0 Answers0