Questions tagged [command-line-arguments]
Programming command line utilities that take parameters.
4,689
questions
0
votes
0
answers
8
views
Write a code to extract the text from the image file. The file should be accepted as a command line argument
from PIL import Image
from pytesseract import pytesseract
path = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
image_path = r"10002.png"
img = Image....
0
votes
0
answers
22
views
Python code to parse time argument from command line to print specific lines of crontab file
I'm writing a Python program that takes the time argument from the command line, compares it with the crontab.txt file and if the time value is same or after the time specified in the command line, It ...
1
vote
0
answers
14
views
Need a program which print out every Symbol of the command line arguments and the fitting argument
my program should print out every symbol in the Set inclusive the fitting command line parameters . So I wrote this :
public static void main(String[] args) {
HashSet<Character> ...
0
votes
0
answers
8
views
Problem : Run Console Application exe having confirm prompt (using PowerShell script in background)
I am trying to run console application in background using powershell script and in the main method of "program.cs" it requires user confirmation. Working of this console application is to ...
0
votes
1
answer
19
views
VS Code debugging prompting for arguments and also setting the working directory
I know how to pass fixed arguments in the launch.json, e.g. In Visual Studio Code, how to pass arguments in launch.json . What I really need is a prompt where I can give a value for an argument that ...
0
votes
1
answer
29
views
How to pass a C program as a Command Line Argument [duplicate]
Im not sure if it is possible, but would like to know if i can use the result of a main() function as the command line argument for another program. im currently using gcc compiler on linux so i ...
-3
votes
0
answers
24
views
What is the meaning of this expression in Go args := os.Args[1:]? [duplicate]
I m learning Go , while I m trying to solve a problem , that needed arguments except the first one but while I was looking on Os library , I also find this expression and I would like to ...
-1
votes
1
answer
25
views
How to make clap ignore a specific field in a struct?
I'm building my Rust CLI with clap.
I have one struct with all the command line options. This struct is passed through to a lot of functions.
Now I would like to add a field to this struct, but not ...
0
votes
0
answers
12
views
Electron command line replaces single backslash with double
I'm building an app in Electron that requires a file path to be passed to it via the command line. I'm able to retrieve the command line arguments and values fine, but the backslash ('\') character ...
0
votes
1
answer
26
views
Run node.js script multiple times with multiple command line arguements on windows
I have a script named index.js which I need to run with multiple command line arguements, one at a time. Something like this:
node index.js ABC
node index.js DEF
.
.
node index.js XYZ
So I have ...
0
votes
1
answer
43
views
Newbie powershell argument issues
I made powershell script that [1] accepts 2 arguments (aka parameters), [2] changes a file's modified date & time, and [3] writes something to host. The following command line works just fine in ...
0
votes
1
answer
24
views
Why are "--slave" and "--no-restore" being used by commandArgs when I call my R file with Rscript
I am running an R script using Rscript from the command line (linux) like this:
Rscript myscript.R inputfile1.csv inputfile.csv integerArg
My command args are structured like this
cmd_args <- ...
0
votes
1
answer
31
views
How to execute python script with multiple arguments and export constant values?
I am very novel in the scripting environment, it has to be a foolish question but I couldn't find the answer...
I would like to compile a .py program with several arguments from a github repository. ...
0
votes
0
answers
19
views
I am trying to write a programme in c that takes 2 pgm file names as arguments, reads them in and tests whether they are logically identical
"test if files are logically identical"
I was asked to write a programme that takes 2 file names as command line arguments reads them in, and then it tests if the two files we were passed ...
0
votes
1
answer
31
views
Detecting negative numbers without interfering with invalid options (starting with -)
I have a bash function that validates numeric values (positive and negative, including integers, floats and in scientific notation).
Using a argument parsing loop, I also want to take care of invalid ...
0
votes
1
answer
29
views
Create Artisan command with option that must specify a value
Laravel's documentation says (emphasis mine):
If the user must specify a value for an option, you should suffix the option name with a = sign…
But then goes on to say:
If the option is not ...
0
votes
2
answers
34
views
How to check whether a command line argument is in a specified format?
I want my program to check if a command line argument is in a specified format.
Here is how the arguments are passed:
python3 <file.py> documents/folder1/file_1.txt
Here is the code that gets ...
0
votes
1
answer
46
views
C# - Console App - How To Read CLI option arguments
Using the System.CommandLine v.2.0.0-beta3.22114.1 and System.CommandLine.NamingConventionBinder v.2.0.0-beta3.22114.1, I'm attempting to create a simple get command with a --name option.
The option ...
0
votes
1
answer
9
views
How to export data in R to a directory that you have created with arguments from the command line?
I am trying to save data (e.g. a png image) into a folder that I create from the arguments of the command line.
This is my script.
#myscript.R
#!/usr/bin/Rscript --vanilla
args<-commandArgs(TRUE)
...
0
votes
1
answer
63
views
Unable to get an array of required size from random_seed subroutine
Based on what I understood from the description of RANDOM_SEED Subroutine here,
https://gcc.gnu.org/onlinedocs/gfortran/RANDOM_005fSEED.html
I tried to get an array of size n by taking n as an input ...
0
votes
0
answers
15
views
Trying to create an array of random elements in Java
I am doing this for the first time. Not sure exactly what I am doing wrong. Any help would be appreciated.
import java.util.Scanner;
import java.util.Random;
public class Main {
static int[]...
3
votes
1
answer
50
views
Pass json string to argument parser python
try to pass json string --model-config {'campaign_id':100500,'run_id':1} to parser:
parser = ArgumentParser(description="")
parser.add_argument(
'--model-config',
type=str,
help=...
0
votes
1
answer
61
views
C#: CommandLineParser, how to pass an array of strings?
I'm using CommandLineParser and I want to pass multiple arguments which should end up in a single array. Here's my class:
public class ClientConfig : Config
{
[Option("load")]
...
0
votes
0
answers
18
views
cmd not running jar file directly
I have created a jar file from Netbeans with a scanner and a subsequent method in main. When I open cmd to run the jar file, I write java -jar [scanner input].
Now when I enter the scanner input, the ...
0
votes
1
answer
52
views
Printing the command line arguments in python
I am learning to pass command line arguments in python. I want to print the argument but I keep on getting the following error:
AttributeError: 'dict' object has no attribute 'fft_length'
My code is ...
-2
votes
2
answers
33
views
Python Command Line Arguments Syntax Error
I am trying to print out the command line arguments, however when I try to have two print statements, I get a syntax error. Is there a reason for that?
This is my terminal input: python3 test.py ...
1
vote
1
answer
67
views
In VS Code I just can't get command line arguments in launch.json working at all. What am I doing wrong?
I just started using VSCode a few days ago and decided to try using it for Python. A quick google search tells me that the launch.json file is where you specify commain line arguments but for the life ...
0
votes
0
answers
16
views
error: the following arguments are required: environment, mode, weight_out, returns_out, episodes, max_iterations, epsilon, gamma, learning_rate
Getting errors while parsing I have created the main function with args and initialized some command line input and called this main function in the if main
with parsing its arguments
usage: ...
2
votes
1
answer
57
views
Running Exe File from CMD using VBA Excel
I am trying to run a simple cmd line from VBA and I am having issues. Basically, the command line calls a createReport.exe which creates a final CSV output file using Inputfile.csv
This is what I run ...
0
votes
1
answer
54
views
Looking to create a script to decrypt password protected PDF files
I have multiple directories of password protected PDF files and I'm looking to decrypt all of these files and save the resulting decrypted file as a new file in the same folder as the encrypted file.
...
0
votes
0
answers
22
views
Problem with select pgsql in command line linux
I have error: -bash: syntax error near unexpected token `('
for this command:
su - postgres -c 'psql -c "(SELECT rabbit_send_msg( \'bip_events\', \'bipxx.Pixi\', json_build_object(\'source\', \'...
0
votes
0
answers
56
views
Dynamic import in Jsonnet
I want to get input file in Jsonnet so the following is working great for me:
local input = import './inputfile.json';
Problem is that I want to pass the file name through the Jsonnet CLI ...
0
votes
1
answer
118
views
How to pass command line arument in spring boot app when running from command line
I am trying to run spring boot app from command line and pass a commnd line argument. I tried several ways none of the works:-
Try 1: mvn spring-boot:run -DCALLBACK_PORT="8000"
Try 2: mvn ...
1
vote
1
answer
28
views
get the parameters entered when the program is runed from thecommand line?
I am a beginner in C# and I recently wanted to develop a program that starts from the command line with some parameters.
Suppose I have a console program now
I run it from the command line and provide ...
0
votes
0
answers
20
views
Optional argument for all subparsers
I am trying to add optional argument, that is available for my command and all sub commands. However I would like, that users can pass this argument (-n, --namespace) anywhere (at begin or at the end ...
0
votes
1
answer
44
views
Python - Allow Argparse to Accept an Option in an Argument
I've been trying to pass a command to argparse, however passing something like pacman -R always ignores -R. I'm using .parse_known_args() to try and solve this, but it still doesn't work. I'm also ...
0
votes
0
answers
57
views
Command line arguments not passing through correctly, argc always returning 1 and argc returning nullpointer on visual studio c++
I was recently working on a project for a class and was having a lot of problems with passing in command line arguments. I decided to test out with a really simple code I found online from ...
0
votes
0
answers
14
views
Python argparse group of options or another one
I want to be able to enforce having either a group of arguments or another one. E.g.,
prog [ --auto | --option1 xxx --subpart1 yyy --subpart2 qqq]
I know that I'd use an add_mutually_exclusive_group ...
0
votes
1
answer
84
views
Problem with the Caesar problem set on cs50 online course
I'm on the stage where we need to correctly setup the command line argument to take only digits and to break out of the code if the user types anything else other than a digit. (leaving it empty, ...
0
votes
2
answers
36
views
Batch to skip delimiter only to a certain moment
I'm trying to get my current username by registry using command line. But my username has two words between a space. Ex.: "Cat Dog". Well, if i use a space as delimiter, it only prints 'Cat',...
-1
votes
1
answer
21
views
How can you add a new spider arg to your own template in scrapy/zyte
I am working on a paid proxy spider template and would like the ability to pass in a new argument on the command line for scrapy crawler. Can someone please tell me how to do that? Thanks.
0
votes
1
answer
33
views
Guidance on Powershell command or script to sort directories evenly based on amount of data
I am in the process of moving my file server from on-prem up to an Azure file share/VM.
I've got everything in place and ready to move, but I am wanting to divide my files up and do it in 4 roughly ...
1
vote
2
answers
94
views
using atoi to convert command-line arguments to int, is only returning the first digit entered
I have to use command line arguments to set up a map for a snake game for my uni assignment. We were not specifically told to use atoi to help convert the command line argument from string to int, ...
0
votes
3
answers
69
views
Use node.js commandline argument as environment variable
I call my node.js application with
node index.js a=5
I want to use the value '5' directly as an environment variable in my code like
const myNumber = process.env.a
(like stated here).
If I try the ...
0
votes
2
answers
33
views
How to pass a parameters on the command line?
I want to run a PHP program from a shell script, passing parameters each time and getting them with $_GET["DBF"].
For example:
$ php prog.php?DBF=clients
$ php prog.php?DBF=suppliers
How ...
0
votes
0
answers
21
views
give argparse arguments from within file (edited with better explanation of question)
A quick question:
If I would like to add arguments in argparse from within the file so that I can execute the file in for example Visual Studio, how should I do this?
The reason is both for learning ...
0
votes
0
answers
31
views
D8016 - incompatible options /clr /await
I copied my CLR_winForms project to another folder and now I get this error. No idea why.
Runtime library setting set to /MDd.
Could not find where is /await option comming from. Can't even see it in ...
1
vote
1
answer
84
views
Why do we need to use 'argparse' in python to interact with Command Prompt?
Recently, I came across the use of 'argparse' library in python. It was used to get the location of input and output directories.
What is the need of using 'argparse', why can't we just use input() to ...
0
votes
0
answers
43
views
How to cause pytest to print a one line traceback and captured output?
When a test fails, I need pytest to print both a single line traceback and the output to stdout and stderr from the failed test. After reading the pytest command line reference, it seems that the --tb=...
0
votes
1
answer
40
views
Keep newlines and tabs in argument to program - Powershell
I'm using Powershell to make a call to a program that prints a Python config file that's structured like this:
[distutils]
index-servers =
some-pypi
[some-pypi]
repository: https://path/to/pypi
...