associating a filetype with a batch script, and getting parameters passed to file of that type.

Posted by Carson Myers on Stack Overflow See other posts from Stack Overflow or by Carson Myers
Published on 2010-04-08T04:08:27Z Indexed on 2010/04/08 4:13 UTC
Read the original article Hit count: 236

Filed under:
|
|

Sorry for the cryptic title.

I have associated python scripts with a batch file that looks like this:

python %*

I did this because on my machine, python is installed at C:\python26 and I prefer not to reinstall it (for some reason, it won't let me add a file association to the python interpreter. I can copy the executable to Program Files and it works -- but nothing out of Program Files seems to work).

Anyways, I can do this, so far:

C:\py> django-admin

C:\py> python "C:\python26\Lib\site-packages\django\bin\django-admin.py"
Type 'django-admin.py help' for usage.

C:\py> django-admin startproject myProj

C:\py> python "C:\python26\Lib\site-packages\django\bin\django-admin.py"
Type 'django-admin.py help' for usage.

but the additional parameters don't get passed along to the batch script. This is getting very annoying, all I want to do is run python scripts :) How can I grab the rest of the parameters in this situation?

© Stack Overflow or respective owner

Related posts about python

Related posts about batch