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
thanks,
a1eio

Hi!

import os
os.system("the_system_command")

Regards, mawe

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:
http://www.daniweb.com/code/snippet113.html

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.