Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 忽略.bat批处理脚本中的问号_Batch File_Scripting - Fatal编程技术网

Batch file 忽略.bat批处理脚本中的问号

Batch file 忽略.bat批处理脚本中的问号,batch-file,scripting,Batch File,Scripting,问题是,我需要将一个带有问号的参数传递给.bat批处理文件。如果我使用问号,参数传递不好。我怎样才能解决这个问题 我的这条线路有问题: script.bat /n"output.owl" /r"http://www.address.com/blog/?feed=rss2" =符号也可能是一个问题。您总是可以只捕获?在批处理文件中,并向用户显示适当的消息 这将对您有所帮助,您已经询问过了。我怀疑这里的问题是原始批处理文件正在使用for循环来 处理命令行选项,问号用于 文件名通配符扩展 >

问题是,我需要将一个带有问号的参数传递给.bat批处理文件。如果我使用问号,参数传递不好。我怎样才能解决这个问题

我的这条线路有问题:

script.bat /n"output.owl" /r"http://www.address.com/blog/?feed=rss2"

=
符号也可能是一个问题。

您总是可以只捕获?在批处理文件中,并向用户显示适当的消息


这将对您有所帮助,您已经询问过了。

我怀疑这里的问题是原始批处理文件正在使用for循环来 处理命令行选项,问号用于 文件名通配符扩展

> type fortest.bat
@echo off
for %%a in (%*) do (
   echo arg is %%a
)
> fortest a b c/?d
arg is a
arg is b
使用位置参数%1和%2可避免通配符扩展 为…做的事。。。(*)循环。shift运算符避免使用通配符 如果需要处理未知数量的参数,也可以进行扩展

> type shifttest.bat
@echo off
:loop
    if "x%1" == "x" goto :eof
    echo arg is %1
    shift /1
    goto :loop
> shifttest a b c/?d
arg is a
arg is b
arg is c/?d

你到底指的是什么?使用简单的批处理“echo%1%2%3”,我对命令行“test.cmd abc??def e?fg”没有任何问题。所有参数都已正确传递和打印,因此我不太理解您的问题。是否仍然可以正常工作?你们这批人想做什么?你能分享代码吗?也许问题不在于参数解析。