开发者

Converting a shell file to a windows batch file

I am told that I need to convert the following .sh开发者_如何转开发 file to a .bat file. I have absolutely no idea how to do that, can anyone give me some hints? It is a short code. Here it is:

#!/bin/bash

#enables execution from another directory
#p=/path/to/PDFAnalyser
p=.

java -cp $p/bin ;$p/../pdfXtk-Extras/jar/pdfxtk-extras.jar ;$p/../pdfXtk-GUI/jar/pdfxtk-gui.jar ;$p/../pdfXtk/jar/pdfxtk-backend.jar ;$p/../pdfXtk/lib/commons-collections-3.1.jar ;$p/../pdfXtk/lib/commons-logging.jar ;$p/../pdfXtk/lib/fontbox-1.1.0.jar ;$p/../pdfXtk/lib/jai_codec.jar ;$p/../pdfXtk/lib/jai_core.jar ;$p/../pdfXtk/lib/jai_imageio.jar ;$p/../pdfXtk/lib/log4j-1.2.14.jar ;$p/../pdfXtk/lib/pdfbox-1.1.0.jar ;$p/../TouchGraph-Modified/jar/touchgraph-modified.jar ;$p/../TouchGraph-Modified/lib/TGWikiBrowser.jar ;$p/../pdfXtk/lib/xercesImpl.jar ;$p/../pdfXtk-Extras/lib/JavaOCR.jar at.ac.tuwien.dbai.pdfwrap.ProcessFile "$@"


You mean a Windows batch file, right? If so, you should specify that in your question.

I don't have a complete answer, but I can give a few syntax tips.

p=. should be changed to set p=..

$p should be changed to %p%.

To execute multiple commands on a line, separate them with & rather than ; (or, better yet, just write one command per line).

Windows uses \ rather than / as a directory separator.

The files are probably going to be in different locations, if they exist at all. This assumes you're taking a .sh file from a Unix-like system and creating a .bat file for a Windows system. If they're both the same system (probably because you're using Cygwin), you should mention that as well.

There is no straightforward way to translate a shell script to a batch file. They're going to be running on different systems. If you have no idea how to do it, your best bet is to find someone who does.


Some more tips:

Lines starting with # are comments. Use rem in the batch file.

The token for all command line arguments %@ must be replaced with %* for the batch file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜