我有以下几点 appcmd
appcmd
c:\perl\bin\perl.exe "%s" %s
appcmd set config -section:isapiCgiRestriction "-+[path='c:\perl\bin\perl.exe \"%s\" %s', allowed='true', description='Perl CGI']"
如果从命令行执行,它会正确执行,但是如果我在 .cmd 批处理文件路径被破坏,结果如下所示:
.cmd
c:\perl\bin\perl.exe "s
麻烦似乎出现了,因为我不得不避开第一个引号 %s perl.exe文件参数。但为什么批处理文件中的行为会有所不同,这有点令人费解。
%s
有人能解释为什么会这样吗?
问题是命令处理器读取 "%s" %s % 符号,因此这将生成一个有效的批处理变量(即 %" % ). 在把它扩展成一无所有之后,只有你的 "s 剩下的。
"%s" %s
%
%" %
"s
你可以逃过一劫
c:\perl\bin\perl.exe "%%s" %%s