使用set来设置特殊字符似乎不起作用[Bat]

时间:2015-03-06 18:44:07

标签: batch-file

我正在编写一个简单的批处理文件,用于根据请求输出jar 所以当我写这个论点时,它必须看起来像this

但是我没有直接写< "input%%~nj.txt" > "output%%~nj.txt"而是想使用变量,所以如果需要的话我可以输出到文件。

我尝试了escaping special charactersset syntax方法 但到目前为止没有运气

这是我的代码段

::per is a variable about setting input or not
::per gets changed to a string after being checked, to be used in java as an arg.
::echo test works so I am sure that there are no errors on that section
IF [%per%]==[1] (set "per= < "input!pth!.txt" > "output%pth%.txt""&echo test)

::testing if per works as intended
::must show per: < "input!pth!.txt" > "output%pth%.txt"
Echo per: %per%

::per shows 1 instead of < "input!pth!.txt" > "output%pth%.txt"
::filename is the name of the jar with .jar
java -Xmx1024M -jar %filename%%per%

那么如何将每variable设置为< "input%%~nj.txt" > "output%%~nj.txt"

0 个答案:

没有答案