Hi dears.
I am playing windows commands with python scripts.
for example I did:

import os
print os.system("ipconfig -a")

but there is a problem with some commands.for example see this:

>netsh
netsh>dhcp
netsh>dhcp>scope 192.168.100.10

after playing the first one script, I have to come back to shell and play second one and ...
but how can I do it and also how can I do it in linux?

Recommended Answers

All 3 Replies

Can you explain better or give some code?

sorry I can not write eng well.
we can play command line's commands in python.
for example in cmd you can play "cls" to clear command line.
and in python we do it like below code:

import os
os.system("cls")

it will play well.but some of commands are that you have to return again to command line and play a new command.

for example:

c:\>

manualy at first you have to type nslookup.then you have to wait.you will see second line that apear like below:

nslookup>

after you have to enter another command.for example:

nslookup>server 127.0.0.1

now I can not play such instructions.I have to return to command line again and play second command.but python will wait for command line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.