Archive

Posts Tagged ‘.bat’

Python on Windows

May 14, 2012 Leave a comment

I pretty much repeated the steps I took for installing Python + PyDev + Eclipse on my Ubuntu 11.10 operating system. This time the operating system was Windows 7 SP1 (and unlike the Ubuntu OS, this one is not running on VirtualBox).

To be able to use Python through command line, I referred to a link from stackoverflow.com. Somehow, even after restarting the machine, I was stilling getting the “not an internal command or filename” error for python, in the command prompt.

After viewing a youtube video, which basically tells the viewer to append “C:\Python27” to the system environment PATH variable, I was able to make the command prompt recognize the python command. Of course, I restarted the system, but I am not sure if that’s necessary. I also haven’t verified whether the action mentioned in the previous paragraph helped at all.

Then I was able to use the trick given at a link, which enables the user to embed python code in a windows batch (.bat) file. The convenience this trick affords is that you can double click the .bat file and it functions like a .exe file. An example is as follows:
Sample python code embedded in a Windows 7 .bat file.