Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

making a python script run cmd command on windows

Hello Friends
I am learning python language for 2 weeks now
i was curious that can we write a script wchich can run a cmd command on windows
like we defince a fucntion and usualy say print
instead of print how can we make it run cmd command.
thanks for help
PHP Code

<?php 
import os
os
.system("dir") etc.. 
(Oct 11, 2015 04:01 AM)SIM-1866423 Wrote:  
PHP Code

<?php 
import os
os
.system("dir") etc.. 

diretory to what..?
lets just say we want to shutdown pc through python script with cmd command
what will that be..?
(Oct 11, 2015 04:51 AM)jackharper Wrote:  diretory to what..?
lets just say we want to shutdown pc through python script with cmd command
what will that be..?

Cmd directory? It's in your system32 folder
Than, shutdown of course .. try it before u ask anything ..

PHP Code

<?php 
os
.system("shutdown now -h") 
(Oct 11, 2015 04:58 AM)SIM-1866423 Wrote:  Than, shutdown of course .. try it before u ask anything ..

PHP Code

<?php 
os
.system("shutdown now -h") 

ok thanks... i did everything i could have...
cheers


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:03 AM 1 299 Sep 24, 2026 10:03 AM
Last Post: Anonynuk
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by HeiиekeиMar 17, 2022 06:49 AM 3 143 Mar 17, 2022 06:49 AM
Last Post: Luffy-_-