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
2 answers

Turn string into string array for command-line arguments

I have string with the following format: "arg1" "arg2" "arg3" ... "argx" I am going to use this string as the string[] for my program's command-line arguments. How can I turn this string into a string array?
disasterkid
  • 6,948
  • 25
  • 94
  • 179
2
votes
1 answer

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…
CarbonX
  • 134
  • 6
2
votes
1 answer

Multiple Command Line Arguments in Python

In my python script, I am reading one text file. For that file, I am giving path to command line in UNIX as follows: python My_script.py --d /fruit/apple/data1.txt I am going to read one more file in same script. So I just wanted to know how to…
SAM
  • 95
  • 1
  • 2
  • 6
2
votes
1 answer

how to check a remote port is open

Creating a windows application to check connection to a few servers. How it is possible to check weather there is a connection exist with the specified port on remote ip? Is there any windows in-built command to check a remote port (command line)?…
2
votes
1 answer

How to pass a docopt argument where the argument is a string with spaces in python

How do I crate a docopt in python where my argument needs to be a string with spaces. I tried putting single and double quotes around it but it doesn't work. This is my docopt string so far. """ Parser Usage: parser.py
Dhruv Patel
  • 426
  • 3
  • 9
  • 19
2
votes
1 answer

How to load MS Word file in new instance?

I want to load word document in different instance using Process.Start() method. This is my code. ProcessStartInfo info = new ProcessStartInfo(); info.FileName = @"D:\MyWordFile.doc"; info.Arguments = "/n"; //I have tried like this but it doesn't…
Shell
  • 6,818
  • 11
  • 39
  • 70
2
votes
2 answers

Command Line Args in pascal

I am new in pascal I have a program which gives result .... I need to pass command line input in in given variable ip1 and ip2. Its can be achieved by ParamStr[1] but it doesn't work. program main; var output : integer; var …
Nirbhav Gupta
  • 106
  • 2
  • 9
2
votes
0 answers

How can I find out the command line arguments of a running application?

I wish to know if an application is running and what commands line arguments were passed on to it, if so. While I can find out if the application is indeed running, I am not sure how I can retrieve the command line arguments which were passed on to…
user1173240
  • 1,455
  • 2
  • 23
  • 50
2
votes
1 answer

Commandline parameter getting truncated

I have simple application that is used to decrypt some value. The app take the decrypted value as a command line parameter, but i am seeing that the value i am passing from the command line is getting truncated. Here is a very simple snippet…
user996808
  • 143
  • 1
  • 10
2
votes
2 answers

Passing command line arguments into WPF C# application and accessing its value

So from this post I got the following code for passing command line arguments into my WPF Application public partial class App : Application { private string _customerCode; public string CustomerCode { get { return _customerCode;…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
2
votes
1 answer

C++ switch statements, using command line arguments

I am trying to use a switch statement to start function calls. The value that needs to be passed into the switch statement in an argument that comes from the command line arguments, meaning that it is stored in argv[]. In my case, this argument is…
surelyq
  • 21
  • 1
  • 5
2
votes
2 answers

What JDBC property corresponds to mysql command line's "--skip-secure-auth" option?

I have one legacy database which needs to be connected like this from command prompt mysql --uUserName -hHostName -pPassword -P3307 -A Schema --skip-secure-auth How do I specify the same in JDBC properties…
RaceBase
  • 18,428
  • 47
  • 141
  • 202
2
votes
3 answers

how to specify an command line argument with a variable in bash

I would like my bash script to take either 2 or 3 arguments with the last argument always being the input file to open. So the index of argument should depend on how many arguments provided. I know this can be realized by if statement, like: if [ $#…
ddd
  • 4,665
  • 14
  • 69
  • 125
2
votes
1 answer

passing special characters to python script in cmd.exe

I need to pass an '&' character to a script, running from Windows cmd.exe. Do you know how to escape it? Carets are used in cmd.exe for general escaping. Trial 1 x:\abc>python args.py "hello world!" "" ^& end args.py hello world! ^& end Trial…
nat.am
  • 31
  • 5
2
votes
1 answer

scons pass arguments to a particular step

I have a very complex scons project. One of the targets include running a unittest application that is generated as part of the build. I would like to be able to say: scons where some magic is something that will…
gsf
  • 6,612
  • 7
  • 35
  • 64