Questions tagged [command-line-arguments]
Programming command line utilities that take parameters.
5,018
questions
0
votes
2
answers
26
views
Map String -> &str from program args
I am trying to map the program arguments which are given as Vec of String into a Vec of &str. I am using the std::env::args() iterator here:
let argv_as_refs: Vec<&str> = env::args().map(...
1
vote
2
answers
48
views
How do I create a temporary path within a PowerShell script?
Given the code below, how do I set a variable that I can use to call the 7z executable? The env:Path approach at the top works once but then the terminal must be reloaded or the command cannot be ...
-3
votes
0
answers
109
views
Command-line arguments parsed by OS and not the program itself in Linux? [closed]
Why are command-line arguments separated arbitrarily in Linux, and how can I receive the input buffer as a single, unaltered string for manual parsing? Is the operating system responsible for this ...
-1
votes
2
answers
52
views
How do I handle escape character in parameter arguments in Python?
skript parameter: "C:\Ordner 1\" "D:\test 2\"
As you can see the parameter arguments given above are two paths ...
if len(sys.argv) > 1:
print(sys.argv[1])
print(...
-2
votes
1
answer
41
views
send unlimited args on command line with value
I am trying to build a generic file for create a table on database I want from command line send something like this python create_table.py table_name=test name=TEXT city=TEXT
so every time I run the ...
0
votes
1
answer
66
views
How to pass multiple values to the same System.CommandLine option?
I would like to pass several numbers to a C# console app and have prepared a .Net Fiddle to demonstrate my issue:
private const long DEFAULT_ALPHA_VALUE = 1234567890L;
private static long[] alphas = { ...
2
votes
1
answer
38
views
Why is C# app not aborted despite the required global option missing?
I have difficulties understanding how the System.CommandLine works and have prepared a short .Net fiddle to demonstrate my issue.
I am trying to create a C# console app, which would be called with --...
0
votes
0
answers
16
views
Recognize efficiently if a parameter was used in the command line calling a script in csh
I have a csh script that is called like this : <Script_name> -OptionA -OptionB -OptionC
Each one of this option may or may not be used, when the script is called, and they can be in any order.
I ...
2
votes
1
answer
30
views
Using tab-completion in the shell for suggested command
*"PowerShell provides completions on input to provide hints, enable discovery, and speed up input entry. Command names, parameter names, argument values and file paths can all be completed by ...
0
votes
0
answers
13
views
Override the usage of calling an enum class in Python [duplicate]
I have what is probably a very obscure problem.
My python script is intended to be ran from the command line with some command line arguments.
Each argument needs to be parsed into a type more useful ...
-1
votes
2
answers
55
views
GetCommandLineArgs triggers "Index was outside the bounds of the array" anomaly on VB.NET
I have a program written in vb.net that when I run from the debugger runs fine but when I run the .exe file I get a "Index was outside the bounds of the array" anomaly. classic "it was ...
-1
votes
0
answers
34
views
How can I run a script in Pycharm using CMD?
I have a problem with running a script in Pycharm project using the command line. Opening other projects and scripts exhibit no problems.
"C:\Program File\JetBrains\PyCharm Community Edition 2023....
0
votes
1
answer
35
views
aapt command works in cmd prompt but not when using Process() in C#
Hey all I am trying to get this command to work using C#'s Process(();
aapt d badging "c:\adb\apks\ftp\ftp.apk" | "C:\adb\grep" package | "c:\adb\sed" -r "s/package: ...
0
votes
0
answers
23
views
os.system() uses inputfile as args and raises unrecognized arguments error
I use MOPAC program in commandline "mopac temp.dat" - it works perfectly resulting in a new temp.arc file
Then I try os.system("mopac temp.dat") in my python script, it results in ...
0
votes
1
answer
30
views
is there any mothod to Enforce Exact Case-Sensitive Flag Matching with argparse in Python
I am working on a Python script using argparse library to handle command-line arguments. I want to enforce strict and case sensitive match for a specific flag. such as --signup , without allowing any ...
0
votes
1
answer
13
views
How to choose config file as command-line argument and present result in the console while maintaining modularization? [closed]
config.ts:
export const data = 'Config';
process.ts:
import { data } from "./config.ts";
const calculated = data + ' is used.'
export {calculated}
main.ts:
import { calculated } from "...
0
votes
0
answers
27
views
Google Chrome memory saver - command line switch?
I'd like to automatically turn on memory saver option in Google Chrome on my Windows machines.
Is there a command line switch that does it? I did some research but no success.
Alternatively, any guess ...
1
vote
1
answer
23
views
Module A imports variable from module main and export it to module B. How to get module main export variable to A and import from B?
Here is my code:
main.js:
const fromMain = '123'
export {fromMain}
import {fromB} from './b.ts'
console.log(fromB)
a.js:
import {fromMain} from "./main.ts";
const fromA = fromMain + 456
...
1
vote
1
answer
52
views
Multiplication in Python not working in the command line
#!/usr/bin/python3
import sys
if __name__ == "__main__":
from calculator_1 import add, mul, sub, div
num_of_args = len(sys.argv) - 1
if num_of_args != 3:
print("...
0
votes
2
answers
30
views
How create variable from different input values on Python? [duplicate]
I am questioning of how I can create two variables containing two of the four input values. They are lat1 long1 lat2 long2 to calculate distance. Here is the code:
from geopy import distance
coords_1 ...
2
votes
1
answer
46
views
Pass argument(file-path) that contains spaces to the Powershell command inside Batch file that itself resides at path with spaces
I have following lines in my Batch script which in turn calls Powershell command to self-elevate the batch file as Admin.
@echo off && setlocal
if not "%1"=="admin" (...
0
votes
1
answer
61
views
Dynamic command line arguments are not getting passed to the script
Here is my pipeline script where I'm calling one shell script and passing the arguments. In this $np and $cp contains special character i.e. # ex: abcdefgh#abd#we23:
def name = 'xyz'
def np = ''
def ...
0
votes
0
answers
38
views
Spaces in directory name, not working code on command line (bash, mac) [duplicate]
I am working in my Google Drive directory that is mounted on my Mac. The path to my Google Drive folder looks like: "/Users/username/Library/CloudStorage/GoogleDrive-gmail-acct/My Drive"
...
-2
votes
1
answer
60
views
"yargs" won't trigger any command of a script
I have a NodeJs script in which I need parse command line arguments.
I've written this code:
import yargs from "yargs";
import { hideBin } from 'yargs/helpers';
//....
yargs(hideBin(...
0
votes
0
answers
19
views
Using csv files as inputs to python script from command line (without importing libraries)
I am solving a problem where I am trying to run a python (3.10) script which uses data from 3 different csv files. In the final product I want to be able to run it directly from the command line, and ...
0
votes
1
answer
44
views
Apply header & footer settings (Adobe Acrobat Pro) [closed]
Searching for a solution to a way to apply the settings xml file to header & footer of pdf file. I have tried the following command line, which arises no errors but I didn't get the output pdf ...
0
votes
0
answers
20
views
Segmentation Fault (core dumped): Error when providing no argument
Code implementation I was trying to implement the code such way that it takes only a command line argument, and if not provided or provided more than 1, it prints out an error message. But it is ...
1
vote
0
answers
57
views
How to know the type of args in c#
I am trying to create a program that adds two arguments regardless of what types the arguments I am passing. Now, I am trying to know the type of the args and then create a new object of my generic ...
1
vote
0
answers
262
views
CMakePresets: How can I add command line arguments to the cmake build?
I have a CMakeLists.txt in combination with CMakePresets.json, Visual Studio 2022 and the generator ninja.
Running the build command in Visual Studio 2022 executes
cmake --build --preset Release
My ...
0
votes
0
answers
19
views
Copying a PS Get-Date output to Clipboard
I'd appreciate some expert input on what errors I have made below :)
I need to:
Copy a PowerShell command string into the Windows Search Bar
Obtain the current system date
Obtain from the current ...
0
votes
0
answers
46
views
Passing a folder of files into a PS1 script via CMD
I'm trying to convert some ASCII files via the command shell (Windows 11).
I have come across an old script and command-line which should do this.
The command goes like this:
dir *.j2w | & d:\...
1
vote
1
answer
137
views
Unable to build installer .vdproj with VS2022 on command line
Previously, we used dotnet core 3.1 and Visual Studio 2019 to develop a WPF project. We also used the (somewhat old) Visual Studio Installer Projects. When we perform a build using our build server, ...
0
votes
0
answers
62
views
C++ Debug with unexpected arguments
I used CMake to build the projekt.
When I run with Debug, I got always others unexpected arguments.
why there're such arguments, although I didn't input these arguments.
argv:2>CON
argv:1>CON
...
0
votes
1
answer
30
views
Cucumber Junit5 Maven runtime options
I searched a lot and dont get it fixed. I want to start maven and execute a specific feature file.
I tried
mvn test -Dcucumber.features="src/cucumber/feature/Jenkins02_Regressiontest.feature"...
0
votes
3
answers
87
views
How to run a specific function from a .py file from command line?
I have a tkinter GUI project. in this project I can load files and run tests on them. I would like to be able to write a script which does this from the command line. This means I need to run the main ...
0
votes
3
answers
120
views
How to open an encrypted PDF file by sending the password as command-line argument?
We have encrypted PDF files, requiring passwords to open. The encryption is only needed for transmission across email, but once the file is saved locally, we would like to provide buttons/shortcuts to ...
1
vote
2
answers
45
views
Get dest for all args in argparser
I would like to get the dest values for all the arguments defined for the parser. I.e. in the case of:
parser = argparse.ArgumentParser()
parser.add_argument('arg1')
parser.add_argument('arg2')
parser....
0
votes
0
answers
46
views
get the selected file from the context menu and send it to the c# project
I am writing a program that adds scripts to the context menu, it works like this.
(ContexMenu.exe) - adds a command to run the program with arguments
type - file type called by the context menu
* - ...
0
votes
0
answers
41
views
Why won't these lins of code compile in Visual Basic / .NET 6?
These two lines of code compile fine when I use a .NetFramework type console build:
My.Application.CommandLineArgs
My.Computer.FileSystem.GetFiles(strFolder)
But trying to compile the same code with ...
0
votes
0
answers
33
views
the first if clause always returns 1 [duplicate]
this solution should return 1 (i.e false) if n is prime, otherwise it returns 0,
the problem is that it always returns 1 because of the first if clause (I've specified a number in the debugging ...
-4
votes
2
answers
190
views
How to open json file with vscode
I was watching a course. He uses linux i think. I install node and npm like him. He write atom . to consol and automatically 'server' which we created first is opened. How can i open that server in ...
0
votes
0
answers
6
views
When the aler coming like that i don't understand and alos couldn't find it with searching on google
"C:\Program Files (x86)\Program\Example\setup.exe" -s"
what does it mean -s command ? what does it do? It's command line of windows or windows server. I need to find what it can do. ...
1
vote
2
answers
114
views
Command line arguments in vuejs
How can I provide command line arguments for a vuejs application?
I use vue 3 for my frontend that communicates with the python backend (flask) via axios.
Right now, I am setting the baseURL for axios ...
0
votes
1
answer
45
views
(Follow Up) How to print out command-line arguments in X86-64 Assembly?
I want to print out command line arguments out in x86-64 assembly(with AT&T syntax).
This is a followup question to my previous post on how simply to access these arguments. I also wanted to know ...
0
votes
0
answers
23
views
Trying to load urls in the same tab. Can it be done:
Is it possible to open the second link: "Link2" in the same tab from the previous link? The current Batch script opens a new tab for the second link. I want to open the second link in the ...
1
vote
0
answers
23
views
Starting Electron React JS application via cli WITH additional arguments
I got my application all done and everything works fine.
However the application needs to be runable via a command, which will be executed by another application.
My package.json scripts look like ...
-3
votes
1
answer
44
views
Caesar: Checking the key
I am trying to check the key of the cipher text to see if every character is an integer.
The code
When I compile the program I get the following error
code compiling error
1
vote
0
answers
27
views
How to use regex expression as the command line argument in VSCode?
How to use regex expression as the command line argument in VSCode?
My launch.json is like:
"version": "0.2.0",
"configurations": [
{
&...
0
votes
0
answers
28
views
Python ArgumentParser strips with space and dash
I need to get the complete string inside quotes as an argument (Possible to use only argparse).But it will stop at space and dash and strips other words in quotes.
Please help to sole this.
Code :
...
0
votes
0
answers
49
views
Use default arguments in npm scripts
I want to use default arguments in npm scripts. After some investigation, I find that
// package.json
...
"scripts": {
...
"format-check:prettier": "prettier --...