command-line-arguments

JSAP - capturing all the arguments including options

For JSAP [java command line parser], I want to use a greedy unflagged option which will capture all subsequent arguments prefixed with '-' as well. program -runName run1 abc --plan I want to capture all the arguments after run1 into a single unflagged option. How to do it? I don't want --plan to be treated as an option but as the value...

Cleaning up control flow when dealing wtih command line arguments [C#]

I'm dealing with a program that does plenty of if...else branching based on command line arguments. This is in C# but I'm sure it's applicable to Java, C++ etc. Here's the general outline: if (args.Length == 0) { //do something } if (args.Length > 0 && args.Length < 2) { Console.WriteLine("Only one argument specified. N...

What are the standard return values for a command line application?

I know that a command line application should return 0 on success. But are there any "standards" for what other values refer to? e.g. Invalid Arguments, etc. Are there differences under Windows and Unix? ...

Java -server argument

Possible Duplicate: Real differences between java -server and java -client? I've seen the argument "-server" used as a command line argument for java.exe: java.exe -server MyClass but no matter how hard I searched the internet I found no documentation as to what exactly it does. Can anyone explain? ...

Command line switches parsed out of executable's path

Why do Windows programs parse command-line switches out of their executable's path? (The latter being what is commonly known as argv[0].) For example, xcopy: C:\Temp\foo>c:/windows/system32/xcopy.exe /f /r /i /d /y * ..\bar\ Invalid number of parameters C:\Temp\foo>c:\windows\system32\xcopy.exe /f /r /i /d /y * ..\bar\ C:\Temp\foo\bl...

bash script running string as command

i have a bash script that builds a string to run as a command the script: #! /bin/bash matchdir="/home/joao/robocup/runner_workdir/matches/testmatch/" teamAComm="`pwd`/a.sh" teamBComm="`pwd`/b.sh" include="`pwd`/server_official.conf" serverbin='/usr/local/bin/rcssserver' cd $matchdir illcommando="$serverbin include='$include' server...

Checking range with command line arguments

Working on a simple C program I'm stuck with an if test: int line_number = 0; if ((line_number >= argv[2]) && (line_number <= argv[4])) gcc says: cp.c:25: warning: comparison between pointer and integer cp.c:25: warning: comparison between pointer and integer What can I do to properly check the range of lines I want to deal with?...

Access command line arguments without using char **argv in main

Is there any way to access the command line arguments, without using the argument to main? I need to access it in another function, and I would prefer not passing it in. I need a solution that only necessarily works on Mac OS and Linux with GCC. ...

Haskell: reading multiple command line arguments

Hi all, Okay, so I am making a program in Haskell that needs to change certain words based on two command line arguments. I have made the replace function and everything works great, but I am stumped getting it to work with command line arguments. Here is the main code: (replace function not included) main = do text <- getContents ...

Invoke Java via Batch File with Filepath Arguments

Hi there, I'm having an issue getting files loaded into an app called GCS, by dragging them onto the executable. GCS can be invoked on Windows with a bat file, which goes like this: @echo off start javaw -Xmx256M -jar "GURPS Character Sheet.app/Contents/Resources/Java/GCS.jar" %* If I hard code a filepath in place of the batch argumen...

Automatically open files given as command line arguments in Python

I have a lot of Perl scripts that looks something like the following. What it does is that it will automatically open any file given as a command line argument and in this case print the content of that file. If no file is given it will instead read from standard input. while ( <> ) { print $_; } Is there a way to do something sim...

Command-Line Parsing API from TestAPI library - Type-Safe Commands how to

Library at http://testapi.codeplex.com/ Excerpt of usage from http://blogs.msdn.com/ivo_manolov/archive/2008/12/17/9230331.aspx A third common approach is forming strongly-typed commands from the command-line parameters. This is common for cases when the command-line looks as follows: some-exe COMMAND parameters-to-the-command ...

Program to call other programs

hello. I am writing a program that will solve a type of min. spanning tree problem. i have 2 different algorithms that I've gotten working in two separate .cpp files i've named kruskels.cpp and prims.cpp. my question is this: each file takes the following command line to run it . time ./FILENAME INPUTFILE FACTOR i would like to make...

Passing a Batch File an Argument Containing a Quote Containing a Space

Hi, On many occasions I have dealt with passing batch files arguments with spaces, quotes, percents, and slashes and all sorts of combinations of them. Usually I managed to figure out how to accomplish what I want, but this time I am stuck. I have tried a couple of hundred combinations now and my head is starting to hurt. I’ve reduced ...

Command$ value disappears

I have a VB6 app. I am trying to figure out what command line parameters got passed into the application. If I type in ? Command$ into the Immediate window, it prints out the command line params fine. Same, if I place Command$ into the Watch window. However, if I assign the Command$ function to a string: Dim s as string s = Comma...

Newlines not being interpreted when passed to php via the command line

I have a PHP script that I'm invoking from another shell script that sends an automated email with a message generated from the shell script. Problem is, when I send the message all the newline characters are printed into the message. How do I get them to be interpreted? sendmail.sh: /path/to/phpscript/sendmail.php "Some Message With N...

Windows is not passing command line arguments to Python programs executed from the shell.

I'm having trouble getting command line arguments passed to Python programs if I try to execute them directly as executable commands from a Windows command shell. For example, if I have this program (test.py): import sys print "Args: %r" % sys.argv[1:] And execute: >test foo Args: [] as compared to: >python test.py foo Args: ['fo...

How to obtain argument not preceded by '-' or '--'

Hi guys, i have a program that needs command line arguments in the form : ./my_program -m256M -tm -t some_other_file The "some_other_file" argument is not bound to -t (-t it's just another functionality) so i can't take it as the optarg of any of the flags, neither can i assume it is the last argument in the list. How can i do this? ...

How can I pass more than one command line argument via c#

I need to pass more than one command line argument via c# for a process called handle.exe: http://www.google.com.mt/search?sourceid=chrome&amp;ie=UTF-8&amp;q=handle.exe First, I need to run the executable file via ADMINISTRATOR permissions. This post has helped me achieve just that: http://stackoverflow.com/questions/667381/programatic...

Problem of * in Command line argument

I wrote a program in Java that accepts input via command line arguments. I get input of two numbers and an operator from the command line. To multiply two numbers, i have to give input as e.g. 5 3 *, but it's not working as written. Why is it not accepting * from the command line? ...