+ 51

<^>Opening the CMD using Python interpreter <^>

import os os.system( ' start ' ) #type the above code in any python interpreter /IDE of your choice. #hit enter / run. #a command prompt window should show. #works on windows only. #it's such little things that make learning python interesting. #hopefully, this is interesting to someone.

24th Jul 2017, 5:51 PM
<^>washika D<^>
<^>washika D<^> - avatar
13 Respuestas
+ 17
That is so cool! I started playing with it. It turns out you can run programs with it too. import os os.system('start notepad.exe') opens Notepad
26th Jul 2017, 10:44 PM
David Ashton
David Ashton - avatar
+ 38
@Alper : thanks for the Additions : @Ipang: sounds like you should test out all of your awesome ideas on your own, when you possibly can : you'll gain most that way : when I test them out, I'll let you know though... ~cheers^_^ @Mr. Ashton : you just made things even more interesting: one can open any file as long as they know the extension! Thanks for the Additions! @Immortal : anytime... @Amrit: thanks for the invite : but I'll get back to posting codes in a few weeks time : I have a tone of stalled projects. @$Vengat: you do that @alireza_HDR: anytime! @Freetoast: I'll post more cross-platform ideas when I come across them.
25th Jul 2017, 7:28 PM
<^>washika D<^>
<^>washika D<^> - avatar
+ 11
That is unfortunate😥. I have an Android.
24th Jul 2017, 6:20 PM
Freetoast
Freetoast - avatar
+ 11
I might try
25th Jul 2017, 3:26 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 11
[still playing with it] It seems you don't even need 'start' - i.e. import os os.system('notepad.exe') also opens Notepad and os.system('cmd') also opens the CMD window Lots to mess around with!
26th Jul 2017, 11:24 PM
David Ashton
David Ashton - avatar
+ 10
@<^> washika D <^> I'll be looking forward to them!
26th Jul 2017, 12:18 AM
Freetoast
Freetoast - avatar
+ 7
Wow!
13th Aug 2017, 4:13 PM
Ramon Berenguer
Ramon Berenguer - avatar
+ 7
Nice to see you again!!
22nd Dec 2017, 7:20 AM
David Ashton
David Ashton - avatar
+ 5
Amrit Mahendra Joseph cordially invites you to the Greatest Sololearn Coder 3.0 Competition at this link... https://www.sololearn.com/discuss/556117/?ref=app
25th Jul 2017, 3:14 PM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 5
so cool. Tnx.
27th Jul 2017, 12:59 PM
Alireza
Alireza - avatar
+ 5
Hi guys, can somebody enlighten me on these points; Is it possible for this Python code to be executed on both local and remote machine? if it can be executed on remote then how can we prevent the misuse of it? (prevent people running stuffs)? Would it give the same result for execution of command line and gui executables? Does os.system function return any meaningful value? if it does, can we assign it to a variable? Sorry for many questions, I only have Android. Thanks,
27th Jul 2017, 9:32 PM
Ipang
+ 5
<^> washika D <^>, Thanks for your response, you're right, I should've at least Google it up anyway. Okay, when I found something I'll post it back here. Best regards,
28th Jul 2017, 9:51 PM
Ipang
+ 4
It also works on linux if you use the corresponding commands For example os.system('konsole') Opens Konsole application of KDE
27th Jul 2017, 8:50 PM
Alper Tiryakioğlu
Alper Tiryakioğlu - avatar