This is probably totally absurd, but...is it possible to, through Python, access the command line and use it? For instance, write a program that outputted all of the files in a given directory, much like
and if you want to make it so that you can type commands into your python commandline
command = raw_input("Enter Command->")
if command.upper() == "Q":
print "invalid command\n"
One thing to note is that if you are just going to make specific calls to the command line to do one thing such as cd directory, you should use the python os module rather than just calling the comman shell.
To perform a cd command from python you ould use the following
This changes the current working directory to C:\Folder. From there you cann call other functions to make directories etc.
You should indeed use existing/available python modules as you have many built-in functions available for exactly what you need instead of having to sift through output to do something specific. Using python modules instead of calling os-specific commands keeps your programs portable and they perform better.
However, just in case you wish to capture output from external commands, you can use popen:
p = os.popen("dir")
for i in p:
print i.strip() # prints the dir output one line at a time
There is module called "commands" which provides a nice wrapper around popen but I have not tried it on Windows.