Список аргументов для запланированного задания

2833
loli

Когда вы редактируете действие запланированной задачи, есть опция «Добавить аргументы».

У программного обеспечения, которое я использую сейчас, есть аргумент

-cp .\Acquisition.Jar et.EPC 

Я гуглил некоторое время и не мог найти, что -cpделает.

Есть ли где-нибудь список этих аргументов? Связаны ли они с используемой программой, и если да, как я могу найти список?

2

2 ответа на вопрос

3
Dave

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

У вас есть ключевое слово, чтобы рекомендовать меня для поиска этих аргументов? Я попытался погуглить с «аргументами» или «параметрами», но ничего не могу найти. loli 8 лет назад 0
@ Лоли, может быть. Это зависит от того, документировали ли разработчики это. Какое программное обеспечение вы используете? Dave 8 лет назад 0
@DavidPostill нашел его. Но в общем, я не знаю, что искать, чтобы найти эти аргументы loli 8 лет назад 0
Вы используете правильные слова. Они называются аргументами или параметрами ... Так что, если вы искали "параметры java" -cp ", это могло бы помочь Dave 8 лет назад 1
ах да ты прав. Я не включил Java в поиск, потому что не знал, что это связано с используемой программой, пока вы не ответили на мой вопрос :) loli 8 лет назад 0
@Dave "командная строка Java" дает ссылку как первое совпадение;) DavidPostill 8 лет назад 1
2
DavidPostill

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.

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html Именно то, что я искал. Я надеюсь, что их будет легко найти, если я хочу найти аргументы для другого вида программного обеспечения в будущем loli 8 лет назад 0
Отлично. Их не всегда так просто найти - поиск «командной строки программы» обычно является хорошим местом для начала. Я уже точно знал, что искал, когда узнал командную строку `java` в вашем вопросе - раньше я был программистом на Java;) DavidPostill 8 лет назад 1
+1 хотя @loli, было бы опасно предполагать, что `-cp` всегда будет означать это (в другой программе, которая может / не может быть основана на Java). Dave 8 лет назад 0
@Dave `командная строка" -cp "` возвращает множество результатов для unix `cp`: / DavidPostill 8 лет назад 1

Похожие вопросы