0

I am able to open cmd.exe using script

import subprocess
subprocess.call("C:\Windows\System32\cmd.exe",shell=True)

But I am unable to send input command to cmd.exe open. I want to achieve something like below mentioned using script

1) script give input command like python to cmd.exe open enter image description here

2) After that script give input command like print "hello" to python prompt comes enter image description here

1
  • open python from python? Commented Jul 16, 2016 at 19:29

2 Answers 2

0

Why not use Python to create a batch file that prints what you want, then execute that batch file? You could either return immediately or keep the command interpreter open: it depends on the command switches you use to run the batch file.

Sign up to request clarification or add additional context in comments.

1 Comment

I know that can be done, but what I want to know is how to give input to any xyz.exe open through python script.
0

You could create a file hello.py containing print "hello", and run it through cmd ?

from subprocess import call
call(["python", "hello.py"])

3 Comments

I know that can be done, but what I want to know is how to give input to any xyz.exe open.
not useful, as I am able to open exe, but unable to give input to that exe

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.