How do i access or call system commands (can't really think of a better thing to call em???)
for example on explorer you can right click on an object and select eject, or format ect ect (mainly eject is what i want to know about)
any help would be greatly appreciated

11 Years
Discussion Span
Last Post by vegaseat

will that work with anything complex, or just stuff that you can do from a windows shell. Unlike linux, windows commands available in the shell can't do everything.


If you know Windows/DOS batch language you can create and save batch file from within Python program, than run it with os.system("mybatfile.bat")


yea, i knew about the popen thingy, the issue i have is that i wouldn't know the actual command that would tell a disk to eject

explanation: 'If you have a memory stick or anything like it, one way of stopping it before you pull it out is to right-click on the icon in the explorer window then select eject from the list, i basically want to know the command that does that or the way to do it without using explorer'


Okay, I got it, you mean explorer the filemanager, not explorer the internet browser. I never knew about eject for flash drives. I always used the "Safely Remove Hardware" icon in lower right corner of Windows, thanks for the tip!

In my prehistoric days of programming I wrote a little code snippet on opening and closing the CD drive. It uses mciSendString() from the winmm.lib file. It's written in C++, but Python should have access too. Take a look at snippet:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.