[IronPython] Receiving command line arguments

Dino Viehland dinov at exchange.microsoft.com
Tue Nov 14 19:37:31 CET 2006

If System.Environment.CommandLine isn't reporting the arguments then it sounds like the arguments aren't getting passed to ipy.exe.  I just tried this on both XP, Server 2k3, and Vista and it worked on all three.  Steps I followed:

Create .ipy file:

copy con foo.ipy
import sys
print sys.argv

Start explorer:

start .

Open foo.ipy

Get the prompt to choose a program, find ipy.exe and start it.

That gives me a new console window that outputs the filename being started and waits for me to hit enter.  Starting it from the console also works.  My guess would be that there's something wrong w/ the file extension association - did you create it through some other means?

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Alex Li
Sent: Friday, November 10, 2006 8:32 AM
To: users at lists.ironpython.com
Subject: [IronPython] Receiving command line arguments

Hi all,

I am on Windows XP.  I wrote a IronPython script that I want to run
from anywhere on my file system.  So I associated the extension (I use
.ipy since I already have .py asscoiated with python.exe) with ipy.exe,
and put my IronPython script into the search PATH.   Now when I open a
command line console anywhere in the file system, I can called my
script directly without typing ipy.exe in front.   However the command
line arguments are not being passed to either sys.argv or

Now if I call my script with ipy.exe (and with full path to my script),
then those command line arguments would show up.

Am I doing something wrong or is this a bug?


users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list