What is command line argument? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is command line argument?

what is its use?

11th Jun 2017, 7:42 PM
Nitin Kumar
Nitin Kumar - avatar
2 Answers
+ 3
When you run scripts from the command line, you can pass arguments to it, such as: $ test.py inputfile.txt output.txt Files are common arguments, but they can e anything that you want some sort of input for. How you access those arguments depends on the language. I wrote some code as an example of how it works in Python, I'm sure it gives a good idea for other languages too: https://code.sololearn.com/cr44589IWqoB/?ref=app
11th Jun 2017, 9:09 PM
Taija
Taija - avatar
+ 1
while interpreting the Java file with java cmd, you can pass arguments ie. String arguments.
11th Jun 2017, 8:42 PM
Ayush
Ayush - avatar