如何告诉FORFILES在路径上执行命令? [英] How to Tell FORFILES to Execute Command on Path?

查看:224
本文介绍了如何告诉FORFILES在路径上执行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆