I am trying to send arguments to a batch file.
I have a batch file, HelloWorld.bat and it asks for 4 inputs in total at various points in the script. I tried using subprocess.Popen, subprocess.call, and os.system but I haven't been able to pass the arguments in. This is what I've got so far:
p = subprocess.Popen(shlex.split("cmd"), shell = True, stdin = subprocess.PIPE)
p.communicate(
"cd " + filepath + "\n" +
"HelloWorld.bat\n" +
"arg1\n" +
"arg2\n" +
"arg3\n" +
"arg4\n"
)
When I run this code it says that wrong command syntax. Is there anyway I can pass arguments to the batch file that will be running in cmd?
Thanks!