Questions tagged [command-line-arguments]

Programming command line utilities that take parameters.

This tag should have questions relating to programming command-line utilities that take arguments.

A command line argument is a parameter passed to a command line program. For instance git status is the Git command line program with the parameter status. Git then acts accordingly to that parameter.

Command line arguments are used in command line programs from the Command Prompt on Windows, a shell on Unix and the Terminal program on Mac OS. These are not visual GUI programs, they are text based.

Learn more: Wikipedia Article Command Line

5018 questions
2
votes
1 answer

Python not printing all the sys.argv

I'm getting a list out of range error from sys.argv[1] and I tried making a simple script with this code. import sys print sys.argv I get this on cmd: C:\...\...\...\py>back.py exampleargv ['C:\\...\\...\\...\\py\\back.py'] I don't know why I…
biosr
  • 65
  • 3
2
votes
1 answer

psexec exited with error code 1 - double quotes

Why does the psexec-executed command below fail when I add double quotes to the parameter? It works fine without psexec with double quotes It works fine with psexec without double quotes! The contents of the .bat file are as follows: set…
2
votes
3 answers

How to use ellipsis in for command line argument?

I just learned two things- 1) How to use ellipsis in JAVA i.e. how to define a variable length argument list for a function. following is a program to demonstrate the above concept. public class variable { public static void main(String[] args) …
Vishal Khare
  • 73
  • 10
2
votes
2 answers

Sending cmd commands and reading results in C#

I want to send commands with arguments and read their answers from cmd. So, I wrote the code below, but it is not working and locks on screen (myString is usually null - ""). I only want to send commands to an opened command prompt. Where is the…
JoshuaJeanThree
  • 1,382
  • 2
  • 22
  • 41
2
votes
1 answer

OCaml illiterate in need of record manipulation assistance

This is a little embarrassing but I've been shown an OCaml program where I know what I want to do but I cannot find the documentation to help me write what I want in the right syntax as I've never used the language before. I made quite a few working…
KG23
  • 105
  • 7
2
votes
0 answers

Run runnable with properties (Jitsi)

I wanted to create runnable jar of Jitsi, one of the most popular SIP communicator. So, I have packaged Jitsi as a runnable jar. It can be used when this runnable jar is passed appropriate VM arguments,…
Lukasz Ciesluk
  • 718
  • 1
  • 17
  • 29
2
votes
2 answers

How to pass (and after get) array of parameters with Commons CLI?

I have following code: options.addOption(OptionBuilder.withLongOpt(SOURCES) .withDescription("path to sources") .hasArg() .withArgName("PATHS") .create()); ... CommandLineParser parser…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
2
votes
3 answers

package for parsing argument in TCL

Does anyone know a standard package for tcl to easily parse the input arguments ? or a ready proc ? ( I have only 3 flags but something general is preferable ).
Foad Rezek
  • 694
  • 2
  • 10
  • 22
2
votes
4 answers

How can I take a variable number of files as input for a python script?

For example I want to be able to run this hypothetical command: $ python script.py *.txt option1 option2 And have it execute on every file that matches *.txt Currently I have only found information on operating on one file at a time from sys import…
2
votes
2 answers

Making Commandline Parameters Optional in Python

I am using ArgParse for giving commandline parameters in Python. import argparse parser = argparse.ArgumentParser() parser.add_argument("--quality", help="enter some quality limit") args = parser.parse_args() print "You gave quality = %s" %…
Rgeek
  • 419
  • 1
  • 9
  • 23
2
votes
1 answer

Split spaces avoiding double-quoted JS strings : from 'a "b \\" c" d ' to ['a','"b \\" c"','d']

I am currently building a small text editor for a custom file format. I have a GUI, but I also implemented a small output console. What I want to achieve is to add a very basic input field to execute some commands and pass parameters. A command…
Demurgos
  • 1,568
  • 18
  • 40
2
votes
2 answers

gwt-maven-plugin: Compile fails "with status 1"

I've been working on a GWT project for a while, and I believe since I've added new dependencies, I get the error below. Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.1:compile (default) on project project: Command [[ /bin/sh -c…
hansi
  • 2,278
  • 6
  • 34
  • 42
2
votes
3 answers

how to execute command line with arguments in C#

So, I'm trying to run a command line, but it doesn't seem to do anything, i have no idea what i am missing, it is supposed to take an .asf video and convert it to .mp4, any idea will be useful, thanks. string path1 =…
MSV123
  • 39
  • 8
2
votes
1 answer

Access position parameters in multi-command inline alias/command

I'm trying to create an alias for a command that renames a folder and then tar-zips it: alias txz='of=$1; nf=$of$(date -I); mv $of $nf; tar cJvf $nf.txz $nf --remove-files' call with txz test_folder I get errors mv: missing destination file…
kirill_igum
  • 3,953
  • 5
  • 47
  • 73
2
votes
1 answer

Deal with many commnadline options in c++

I have a c++ program whose main function looks something like this: if(a.size == 2) { if(s1) { f1(a[0], a[1], "string1"); } else{ f1(a[0], a[1], "string2"); } } if(a.size == 1) { if(s1) { f1(a[0],…
qed
  • 22,298
  • 21
  • 125
  • 196
1 2 3
99
100