2

When you edit the action of a Scheduled Task, there's the option of "Add arguments".

The software I use right now has the argument

-cp .\Acquisition.Jar et.EPC

I've been googling for a while and couldn't find what -cp does.

Is there a list somewhere of these arguments? Are they related to the program used and if so, how can I find the list?

0

2 Answers 2

2

What is a -cp argument (option)

Your program is a Java program.

In this case you need to be aware that there are options and arguments which are different entities.

The option -cp (short for -classpath) specifies a list of directories, JAR files, and ZIP archives to search for class files.

The other possible options for a Java program are documented in java - Launches a Java application.

The values after the jar file name are arguments that are passed to the main method. You will need to refer to the documentation provided with the jar file to see the allowed arguments and their meaning.


The Java command line

Synopsis

java [ options ] class [ arguments ]

java [ options ] -jar file.jar [ arguments ]

javaw [ options ] class [ arguments ]

javaw [ options ] -jar file.jar [ arguments ]

options

  • Command-line options. See Options.

class

  • The name of the class to be called.

file.jar

  • The name of the JAR file to be called. Used only with the -jar command.

arguments

  • The arguments passed to the main function.

...

Standard Options

...

-classpath classpath

-cp classpath

Specifies a list of directories, JAR files, and ZIP archives to search for class files. Separate class path entries with semicolons (;). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable.

If -classpath and -cp are not used and CLASSPATH is not set, then the user class path consists of the current directory (.).

As a special convenience, a class path element that contains a base name of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. A Java program cannot tell the difference between the two invocations.

For example, if directory mydir contains a.jar and b.JAR, then the class path element mydir/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A class path entry consisting simply of * expands to a list of all the jar files in the current directory. The CLASSPATH environment variable, where defined, will be similarly expanded. Any class path wildcard expansion occurs before the Java VM is started. No Java program will ever see wild cards that are not expanded except by querying the environment. For example, by calling System.getenv("CLASSPATH").

Source java - Launches a Java application.

4
  • docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html Exactly what I was looking for. I hope these will be easy to find if I want to find arguments to another kind of software in the future
    – loli
    Jul 6, 2015 at 13:58
  • 1
    Great. They are not always so easy to find - search for "program command line" is usually a good place to start. I already knew exactly what I was looking for as I recognised a java command line in your question - I used to be a Java programmer ;)
    – DavidPostill
    Jul 6, 2015 at 14:10
  • +1 although @loli, it could be dangerious to assume that -cp will always mean this (in other program which may/may not be java based).
    – Dave
    Jul 6, 2015 at 14:13
  • 1
    @Dave command line "-cp" returns lots of results for unix cp :/
    – DavidPostill
    Jul 6, 2015 at 14:15
3

The argument is unique to the software, not to Task Scheduler.

I use this a lot when writing software, it's essentially a flag/command so when my program is run from task schedulder, it gets passed a value, such as file path and a command. The command tells my program what do with it.

EG, I have written some back up software, which runs from task scheduler. The parameter it passes is:

"path\file.bmup" -s

In this case the -s means it shows the GUI and doesn't just run in the background.

Or it could be

"path\file.bmup" -e

In this case, it sends an email when the program is finished.

As to what they mean - if the developers do not provide any documentation, it's very hard to know. There are some 'standards' but they only work if people follow the standards. EG, -f often means force but there is no reason my software can't read -f as Finnish language

6
  • Do you have any keyword to recommend me for finding these arguments? I tried googling with "arguments" or "parameters" but can't find anything.
    – loli
    Jul 6, 2015 at 13:51
  • @loli, may be. It depends on if the developers documented this. What is the software you are using?
    – Dave
    Jul 6, 2015 at 13:58
  • @DavidPostill found it. But it's just that in general, I don't know what to search to find these arguments
    – loli
    Jul 6, 2015 at 14:00
  • 1
    You are using the correct words. They are called arguments or parameters... So, if you searched for java parameters "-cp" it may have helped
    – Dave
    Jul 6, 2015 at 14:02
  • 1
    @Dave "java command line" gives the reference as the first match ;)
    – DavidPostill
    Jul 6, 2015 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .