-6ren">
gpt4 book ai didi

windows - 此时管道字符 "|"是意外的

转载 作者:可可西里 更新时间:2023-11-01 11:51:18 26 4
gpt4 key购买 nike

我有以下脚本可以在多个 JAR 文件中找到一个类。类名作为字符串参数传递。

set ARG=%1
for /R %G in (*.jar) do @jar -tvf %G | find %ARG% > NUL && echo %G

给我以下错误

> findClassInJar.bat "ContentPartition"
> set ARG="ContentPartition"
| was unexpected at this time.
> for /R G | find "ContentPartition" > NUL && echo G

如何解决这个错误?

最佳答案

对于批处理文件中的循环变量,您应该使用 %% 而不是 %。即,将 %G 替换为 %%G。否则,它将被解释为一个参数。

关于windows - 此时管道字符 "|"是意外的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29045800/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com