command-line-arguments

Memorizing *nix command line arguments

For my developer work I reside in the *nix shell environment pretty much all day, but still can't seem to memorize the name and argument specifics of programs I don't use daily. I wonder how other 'casual amnesiacs' handle this. Do you maintain an big cheat sheet? Do you rehearse the emacs shortcuts when you take your weekly shower? Or i...

Bash: piped argument to open command fails. Open commands excutes too early?

I'm pretty much a novice to shell scripting. I'm trying to send the output of some piped commands to an open command in bash in OSX. My ultimate goal is to compile a Flex/Actionscript application from TextWrangler by calling a bash script with a little Applescript and have the result played directly in a Flash Player. The Applescript is...

Is it possible to accept custom command line parameters with InnoSetup

I am preparing an installer with Innosetup. But I'd like to add additional custom (none of the available parameters) command line parameters and would like to get the value of the parameter, like: setup.exe /do something check if /do is given, then get the value of something. Is it possible? How can I do this? ...

C++ command line argument comparison

I am doing some validation of the arguments passed by command line in C++ and am having some difficulties. I am doing like so ./a.exe inputfile.txt outputfile.txt 16 flush_left And I am trying to do the validation like so if(argv[4] == "flush_left" || argv[4] == "flush_justify" || argv[4] == "flush_right"){ And its not working out...

Conventional ways to pass arguments to interpreted program

I'm writing an interpreter. The interpreter accepts arguments that it itself uses, including a file to interpret. The interpreted program should not see the interpreter arguments when it queries for arguments and should see arguments meant for the interpreted program. But that's not difficult to do. Instead, I'm interested in styles on h...

How to verify which flags were read using Getopt::Long in Perl?

myscript.pl my $R; my $f1 = "f1.log"; my $f2 = "f2.log"; my $f3 = "f3.log"; sub checkflags { GetOptions('a=s' => \$f1, 'b=s' => \$f2, 'c=s' => \$f3, ); open $R, '>', $f1 or die "Cannot open file\n"; # Line a } All the flags are optional. If I call the script as perl myscript....

Skip unknown command line arguments

In a current application I have, the incoming command line parameters are parsed on several "levels". At the highest level I only wish to parse some options and leave the rest to "lower levels". however, all libraries I've tried so far (Common Cli, args4j, JOpt, gnu.jargs) al throw an "unknown option" exception when I'm trying to feed t...

getopt - parameters that aren't flags?

I'm trying to use the getopt function for the first time only I'm having problems with arguments that aren't flags. For instance, in my code when a unknown argument is given I want to use it as a input file. When I run this with only a file name it is not printed, if I first use a flag, any flag, then I can print it. How can I fix this?...

Auto-complete command line arguments

In bash, executables such as mplayer and imagemagick's "convert" have a cool auto-complete functionality on their command line arguments. For instance, if I type mplayer <tab><tab> in one of my folder, then mplayer will list all media files located in that folder, and only the media files. Similarly, if I type convert -<tab><tab> ...

Passing command line arguments in Visual Studio 2010 ??

Hey Guys ! I am a novice coder.. Need your help .. I am currently working on a C Project and could not figure out how to pass command line arguments to my main function in Visual Studio 2010 Express Edition .. I want to debug and also kind of figure out how these command line arguments work.. PLEASE HELP !! Thankyou fellows ...

Does the Poco C++ Library Support positional command line arguments?

I can see no way to support positional command line arguments with Poco's Poco::Util::Application class and related Poco::Util::OptionProcessor. Positional arguments are unnamed arguments on the command line, coming at the end after all other options, as such: someprogram -b --what=121 filename.bin In that example, filename.bin is a p...

Parsing arguments with defaults and flags.

I've got a ruby bin with some arguments, namely -s, -c and -r (short for scrape, create and run). Now I'd like to set some defaults to scrape and create ('.' in both cases), but if I use :default in trollop, I can't check wherever that argument is set or not. project --scrape should be equivalent to project --scrape . how to achiev...

ShellEx: Starting Excel minimized or hidden

Using the following code I can run Excel from within C#: System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "cmd.exe"; p.Start(); Can I make Excel start hidden or minimized using any command line parameters? (Edit: Tried p.StartInfo.WindowStyle and it had no effect.) I need to start Excel without...

How to escape spaces containing path

To pass a path with spaces to .NET console application you should escape it. Probably not escape but surround with double quotes: myapp.exe --path C:\Program Files\MyApp becomes new string[] { "--path", "C:\Program", "Files\MyApp" } but myapp.exe --path "C:\Program Files\MyApp" becomes new string[] { "--path", "C:\Program Files\MyApp"...

Launching JVM from within another JVM - Bad idea for avoiding code duplication?

I have a Java console application that is launched from a batch script in Windows and a shell script in Linux. In both cases, any command-line arguments (which are complex) are simply passed into the java app, which interprets them using Apache Commons CLI. Now I want to allow users to allocate additional memory to the program. The simp...

xargs with multiple arguments

I have a source input, input.txt a.txt b.txt c.txt I want to feed these input into a program as the following: my-program --file=a.txt --file=b.txt --file=c.txt So I try to use xargs, but with no luck. cat input.txt | xargs -i echo "my-program --file"{} It gives my-program --file=a.txt my-program --file=b.txt my-program --file=...

Is it possible to start Opera in Kiosk Mode without command line switches?

Hi everyone... I'm trying to setup Opera to run in Kiosk Mode without using any command line switches on Windows XP. Originally I had it working by using a desktop shortcut with about 5 or 6 command line switches tagged on the end of the path to the opera.exe such as: "C:\Program Files\Opera\opera.exe" -kioskmode -kioskresetstation -no...

How do I run an incrementally-compiled NetBeans application from the command line?

I tend to develop a lot of console applications using NetBeans. Many of these applications use arguments from the command line, which I constantly change while testing and debugging, so it is frustrating to have to pull up a dialog box in NB every time I want to change the arguments. Furthermore, many of these arguments are filenames, ...

Echo All Palindromes, in C

I love the ideas presented in Brian Kernighan and Rob Pike's book, "The UNIX Programming Environment," where they focus on the point of working within an environment where you can put together many (small, precise, well understood) programs on the command line to accomplish many programming tasks. I'm brushing up on strict ANSI C conven...

What's an effective way to parse command line parameters in C++?

Is there a really effective way of dealing with command line parameters in C++? What I'm doing below feels completely amateurish, and I can't imagine this is how command line parameters are really handled (atoi, hard-coded argc checks) in professional software. // Command line usage: sum num1 num2 int main(int argc, char *argv[]) {  ...