Skip to main content
Filter by
Sorted by
Tagged with
160 votes
10 answers
231k views

I have a code and I need to pass the arguments like name from terminal. Here is my code and how to pass the arguments. I am getting a "File not found" kind error that I don't understand. I have tried ...
128 votes
7 answers
103k views

Question cribbed from here: I have a program that takes input from stdin and also takes some parameters from command line. It looks like this: cat input.txt > myprogram -path "/home/user/work&...
3 votes
1 answer
3k views

Very simple setup, please do try this at home. test.ps1 $args test.rb (replace with language of choice, if necessary) p ARGV test.bat @echo off ruby test.rb "foo bar moo" powershell .\test....
2 votes
1 answer
100 views

I am trying to debug python code in vscode using a launch config that asks for command line arguments. My script is located here: C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\...
0 votes
1 answer
82 views

I'm writing a Rust program where I do manual command-line argument parsing. I skip the first argument since that's the executable and I don't care about that, then check the second argument for what ...
2 votes
2 answers
719 views

For parsing boolean command-line options using Python's built-in argparse package, I am aware of this question and its several answers: Parsing boolean values with argparse. Several of the answers (...
12 votes
4 answers
671 views

I'm writing a Python script using subprocess to hardcode subtitles onto a video. My code builds a complex filter graph for ffmpeg's -vf argument, which includes burning in multiple layers of styled ...
2 votes
2 answers
3k views

I am trying to parse commandline arguments and execute a function that takes the parameters upon successful extraction of the parameters. I have an object called CurrencyExchangeRunner where the main ...
2 votes
1 answer
633 views

I have a .ps1 file that I run from PowerShell, the code is as follows: $strTables = "" $tables | ForEach-Object{ $strTables += "-t $_ " } # $strTables = -t ...
2 votes
2 answers
1k views

I have a batch file test.bat I understand we can give it multiple arguments and take those values using %1, %2, and so on. But I do not know how many arguments will be given. I thought of constructing ...
20 votes
4 answers
39k views

I have booted my system from a live Ubuntu CD, and I need to fix some package problems. I have mounted my hard drive, and now I want to run apt-get as if I booted normally. ie change the working ...
724 votes
11 answers
1.4m views

In many C++ IDE's and compilers, when it generates the main function for you, it looks like this: int main(int argc, char *argv[]) When I code C++ without an IDE, just with a command line compiler, I ...
5 votes
3 answers
6k views

I am trying to make a batch file that would launch Firefox. I need to open one private Firefox window with two tabs in it. I tried various combinations of -new-tab and -private-window, but I can't ...
1 vote
2 answers
137 views

I want to add a Option<bool> to the root command but still show the default output when the option is not provided. RootCommand rootCommand = new RootCommand("My root command"); ...
0 votes
1 answer
12k views

I am trying to run the powershell script from the command line along with the arguments but it is always failing with the below error. Can anyone help? cmd /c "C:\Windows\System32\WindowsPowerShell\...
5 votes
2 answers
968 views

In GNU/Linux I would do: PROGPATH=/long/and/complicated/path/to/some/bin $PROGPATH/program args... but in Powershell if I try this: $PROGPATH=\long\and\complicated\path\to\some\bin $PROGPATH\program ...
-1 votes
1 answer
270 views

I am porting a python script to C++ and have not found a way to express an argument such as: --metadata KEY VALUE In the C++ argument parsing libraries I've seen: boost::program_options TCLAP Gflags ...
0 votes
3 answers
2k views

I'm trying to write a Java wrapper which will internally call a shell script passing the required arguments to the script. My class would be called as follows: MyClass --arg1 value1 --arg2 value2 --...
6 votes
1 answer
127 views

https://martimm.github.io/gnome-gtk3/content-docs/tutorial/Application/sceleton.html , abbreviated: In Raku, it is important that the main program is kept small. This is because all code, program and ...
-1 votes
1 answer
90 views

I'm struggling to get runtime arguments and combine them into a list. I'd like for run-time arguments to be like the following python main.py --all or python main.py --endpoint1 --endpoint2. I only ...
3 votes
4 answers
2k views

Need a Java regex pattern for the following scenario: Case 1: Input string: "a" Matches: a Case 2: Input string: "a b" Matches: a b Case 3: Input string: "aA Bb" cCc 123 4 5 6 7xy "\"z9"...
8 votes
2 answers
4k views

With a root command: new RootCommand { new Option<string>("--myoption") }; how do you tell the difference between ./myapp and ./myapp --myoption "" ? I initially ...
1 vote
0 answers
847 views

I have a C# console application, which is triggered on Windows Task Scheduler periodically, but I need to get the "Correlation ID" of process started and pass to my app by argument, like the ...
1 vote
4 answers
513 views

I am trying to parse a list of command-line arguments (contained in the special "$@" Bash variable) that shall be passed on to the Linux ls binary. The arguments may optionally contain keyword ...
-1 votes
2 answers
74 views

I want my application to work on several files and have a different set of options for each input file: python my.py -a file_a -b file_b --do-stuff=x file_c ffmpeg uses this idea for its command line ...
0 votes
1 answer
110 views

I am writing a program for working with functions and graphs, but that is beside the point. In my int main() I just look at the command line arguments, and then match them up to the expected result. ...
1 vote
3 answers
465 views

I'm trying to make a command line tool out of a bash script. It is very simple: grep ">" in_file >> out_file. So I want to copy all lines containing '>' from the first file to the second. ...
0 votes
2 answers
1k views

I want a shell script that can take advantage of a few optional flags in this style: script.sh --foo "foo message" --bar "bar message" script.sh --foo "foo message" ...
1 vote
1 answer
100 views

I want to make a bash script which invokes some simple commands in the following way ./myscript magicword would invoke #!/bin/bash cat * | grep "$@" However I want to add one more level of ...
0 votes
1 answer
74 views

I searched and couldn't find anything on concatenating strings and numbers in a windows command script. I am trying to get create a log file with the date and time in the name and alls I get is the ...
1 vote
1 answer
50 views

There is plenty of info out ther about accessing -a type arguments But I want to create a script with usage like so, Actually I have already writin the help text usage: pubkeys command options This ...
0 votes
1 answer
527 views

I'm trying to build a script in bash and building a getopts loop. I have two options(x and h) that don't have any arguments and the other two have it. But my while loop fails by taking only one option ...
1 vote
1 answer
183 views

Suppose I execute a command which prompts the user for input. Is there a way by which I can pass the input in the command itself, rather than taking the input from the user. Like for example, in ...
0 votes
1 answer
239 views

This tiny Shell script called prepareFastaRef.command is supposed to receive a file name I am giving as an argument, generate the path based on it, then run a command on that file. It looks like: #!/...
0 votes
1 answer
57 views

I have a script that can be provided with [the potential] to have an unknown quantity of known arguments That is, I know ALL the arguments that can be provided, but as they are all optional, they may ...
0 votes
1 answer
78 views

I accidentally found the key of Meta(Alt_left)+M to enable mouse support using nano. I'd like to invoke nano -m for mouse support each time. ~ command -V nano nano is hashed (/bin/nano)
0 votes
1 answer
90 views

I am trying to read a piece of text as a command line arg and print it out. This is my shell script (script.sh): #!/bin/sh input=${1} echo ${input} This is how I am calling my script: ./script.sh Af)...
0 votes
0 answers
43 views

In case it matters, I'm running 2025.06.25 of OpenSCAD. If I have an instance of OpenSCAD running I can open additional source files such as libraries in the same instance using the menu system. Such ...
-1 votes
2 answers
2k views

The windows cmdkey command can be used to add credentials for accessing remote resources. cmdkey For the most part, it is clearly documented. One part that is not is the targetname parameter. ...
1 vote
1 answer
2k views

I have a simple program to print the command line arguments in zsh. However, I see different behaviour with printf vs echo. Can anyone explain? #!/bin/zsh echo "$# @ : "$@" " ...
264 votes
6 answers
239k views

I was doing some complex stuff with Docker, but as turn out I don't know what -it flag means. Recently I've come across on some example of docker run command which has confused me a little: docker run ...
26 votes
6 answers
29k views

I have an OpenEmbedded environment using bitbake to do some builds. I wanted to get something "interactive" going on where bitbake would pause and ask for input then continue with the build but I've ...
5 votes
1 answer
215 views

A while ago there was a security advisory published for Rust that the standard library's Command API was not sufficiently handling arguments passed to cmd.exe and .bat files such that malicious ...
0 votes
2 answers
2k views

I am writing a TCL scripts which expects command line arguments. Say the name of my script is myTcl.tcl , and in this case , invoking script with the command line arguments will look something like : ....
10 votes
2 answers
17k views

I am trying to detect when particular applications are launched. Currently I am using NSWorkspace, registering for the "did launch application" notification. I also use the runningApplications method ...
908 votes
33 answers
1.0m views

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars). When I try to delete all PDFs together using the following command: rm -f *.pdf I get ...
560 votes
33 answers
631k views

I would like to have the long and short forms of command line options invoked using my shell script. I know that getopts can be used, like in Perl, but I have not been able to implement the same using ...
143 votes
9 answers
383k views

I'm working on a Perl script. How can I parse command line parameters given to it? Example: script.pl "string1" "string2"
0 votes
1 answer
107 views

I'm working on a Spring Shell-based application where I need to process dynamic command-line arguments. I have implemented logic for a specific format, but I’m encountering issues when the order and ...
1 vote
1 answer
86 views

Search engines and reading the manuals are failing me. I'm not sure if there's a way to have E.G. gcc or clang output the final 'configuration' result of parsed command line arguments to check myself ...

1
2 3 4 5
102