Forums

Command Line Arguments

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Command Line Arguments

Postby Imagine3163 » Fri Sep 26, 2008 12:10 pm

Hi, I was wondering what the syntax is for taking in parameters via command line. In Python, you can just subscript args (args[1]) to grab anything else that the user inputed into the command line as an additional parameter. I know how to grab input from command line using this syntax (Console.readLine), but I need a way to take the input from the beginning when you are telling the console what program to run.

Thanks.
Imagine3163
 
Posts: 5

Re: Command Line Arguments

Postby Charles » Fri Sep 26, 2008 12:33 pm

for arg in CobraCore.commandLineArgs
print arg

To pass in the args, you must run the program separately (e.g., not through cobra.exe):

cobra -c myprog
myprog arg1 arg2

There is a patch to address this which I will be applying soon. After the patch, you'll be able to say:

cobra -r myprog arg1 arg2
or:
cobra myprog -- arg1 arg2

Whichever you prefer.

-Chuck
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Command Line Arguments

Postby Imagine3163 » Fri Sep 26, 2008 4:10 pm

That is exactly what I was looking for thank you!
Imagine3163
 
Posts: 5


Return to Discussion

Who is online

Users browsing this forum: No registered users and 114 guests

cron