如何告诉FORFILES在路径上执行命令? [英] How to Tell FORFILES to Execute Command on Path?
问题描述
在以下Windows Server 2k3批处理命令中,我遗漏了一些(显而易见的)转义我的字符串或空格。
I'm missing something (obvious?) about escaping my strings or spaces in the following Windows Server 2k3 batch command.
FORFILES -m *.wsp -c "CMD /C C:\Program^ Files\Common^ Files\Microsoft^ Shared\web^ server^ extensions\12\bin\stsadm.exe^ -o^ addsolution^ -filename^ @FILE"
导致以下错误
'C:\Program Files \Common Files \Microsoft共享\web服务器扩展\12 \bin \stsadm.exe -o addsolution - 文件名foobar.wsp'不被识别为内部或外部命令,可操作的程序或批处理文件。
'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe -o addsolution -filename "foobar.wsp"' is not recognized as an internal or external command,operable program or batch file.
t找出为什么。我正在解决 Simon Sheppard的精细文档
But I can't figure out why. I'm working off Mr. Simon Sheppard's fine documentation
推荐答案
路径需要引用,引文必须转义。 >
The path needs to be quoted, and the quote must be escaped.
FORFILES -m *.wsp -c "CMD /C ^0x22C:\Program^ Files\Common^ Files\Microsoft^ Shared\web^ server^ extensions\12\bin\stsadm.exe^0x22 -o^ addsolution^ -filename^ @FILE"
一个同事建议使用十六进制,我最终发现十六进制需要转义。
A co-worker suggested using the hex for ", and I eventually figured out that the hex needed escaping.
这篇关于如何告诉FORFILES在路径上执行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!