英文:
Command Runs on Command Line But Not in Batch File
问题
抱歉,如果这是一个简单的问题,但我感到困惑。请帮助!
当我将此命令粘贴到命令行时,它可以正常运行:
java "-Dcloudcard.api.accessToken=s0olREDACTEDREDACTEDREDACTEDREDACTED" "-Ddownloader.fetchStatuses=READY_FOR_DOWNLOAD,APPROVED" "-Ddownloader.photoDirectories=C:\UCI_ID\ID_Photos\student\Pictures" -jar cloudcard-photo-downloader.jar
然而,当我将其保存到批处理文件中时,它不能正确运行。它似乎在等号(=)处拆分命令。以下是我得到的输出...
C:\UCI_ID\cloudcard-photo-downloader>Run2
C:\UCI_ID\cloudcard-photo-downloader>java "-Dcloudcard.api.accessToken=
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
... {java usage output removed for brevity} ...
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
C:\UCI_ID\cloudcard-photo-downloader>s0olREDACTEDREDACTEDREDACTEDREDACTED" "-Ddownlo
ader.fetchStatuses=READY_FOR_DOWNLOAD,APPROVED" "-Ddownloader.photoDirectories=C
:\UCI_ID\ID_Photos\student\Pictures" -jar cloudcard-photo-downloader.jar
's0olp4k40nbooqjfvn3mkvbe4ftceocd" "-Ddownloader.fetchStatuses' 不被视为内部或外部命令、可操作的程序或批处理文件。
提前感谢!
英文:
I'm sorry if this is a simple question, but I'm befuddled. Please, help!
This command runs correctly when I paste it on the command line
java "-Dcloudcard.api.accessToken=s0olREDACTEDREDACTEDREDACTEDREDACTED" "-Ddownlo
ader.fetchStatuses=READY_FOR_DOWNLOAD,APPROVED" "-Ddownloader.photoDirectories=C
:\UCI_ID\ID_Photos\student\Pictures" -jar cloudcard-photo-downloader.jar
However, when I save in into a batch file, it does not run correctly. It seems to be splitting the command at the =
sign. Below is the output I get...
C:\UCI_ID\cloudcard-photo-downloader>Run2
C:\UCI_ID\cloudcard-photo-downloader>java "-Dcloudcard.api.accessToken=
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
... {java usage output removed for brevity} ...
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m
ore details.
C:\UCI_ID\cloudcard-photo-downloader>s0olREDACTEDREDACTEDREDACTEDREDACTED" "-Ddownlo
ader.fetchStatuses=READY_FOR_DOWNLOAD,APPROVED" "-Ddownloader.photoDirectories=C
:\UCI_ID\ID_Photos\student\Pictures" -jar cloudcard-photo-downloader.jar
's0olp4k40nbooqjfvn3mkvbe4ftceocd" "-Ddownloader.fetchStatuses' is not recognize
d as an internal or external command,
operable program or batch file.
Thanks in advance!
答案1
得分: 1
将以下内容原样复制到您的batch-file
中:
java -Dcloudcard.api.accessToken="s0olREDACTEDREDACTEDREDACTEDREDACTED" ^
-Ddownloader.fetchStatuses="READY_FOR_DOWNLOAD,APPROVED" ^
-Ddownloader.photoDirectories="C:\UCI_ID\ID_Photos\student\Pictures" ^
-jar cloudcard-photo-downloader.jar
当然,也可以将其放在一行上,但这会去掉插入符号^
,但在这里和您的batch-file
中,这样做会使其更易读。
英文:
Copy this as is into your batch-file
:
java -Dcloudcard.api.accessToken="s0olREDACTEDREDACTEDREDACTEDREDACTED" ^
-Ddownloader.fetchStatuses="READY_FOR_DOWNLOAD,APPROVED" ^
-Ddownloader.photoDirectories="C:\UCI_ID\ID_Photos\student\Pictures" ^
-jar cloudcard-photo-downloader.jar
It can also be single line, obviously then excluding the carets ^
, but this makes it a little more readable here and in your batch-file
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论