Calling batch file that calls python script that uses parameter defined in initial batch file -


this question has answer here:

i've 2 batch files, a.bat , b.bat, python script c.py
a.bat looks this:

call b.bat hello 

now of course, if use %1 in b.bat, batch file view value "hello". now, if have b.bat call c.py, need c.py able recognize %1 hello, same way b.bat recognizes that.
of course, i've tried writing in b.bat:

call c.py %1 

and using %1 in c.py in batch file, did not work. don't know if means can't use %1 parameter or if can't use parameter of type in python, or both. so, how able use parameter in c.py defined in a.bat?

to access parameters in python, use:

import sys print(sys.argv[1])  # view first parameter, similar %1 in .bat 

ref: https://docs.python.org/3/library/sys.html#sys.argv


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -