Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Python by (19.9k points)

Anyone can help me that how to pass two commands in Popen function

I have to pass following two commands to be executed in cmd console

netsh wlan set hostednetwork mode=allow ssid=kumawat_infinity key=123456789a

NETSH WLAN start hostednetwork

This command will enable hotspot in the window.

import os

os.popen('netsh wlan set hostednetwork mode=allow ssid=kumawat_infinity  key=123456789a')

os.popen('NETSH WLAN start hostednetwork')

1 Answer

0 votes
by (19.9k points)

In bash you can just put both commands one after the other in a string separated by a semi colon.

Example:

os.popen(

    'netsh wlan set hostednetwork mode=allow ssid=kumawat_infinity  key=123456789a; netsh wlan start hostednetwork'

)

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...