如何告诉forfile在PATH中执行命令? [英] How to tell forfiles to execute command in PATH?

查看:50
本文介绍了如何告诉forfile在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 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.

但是我不知道为什么.我正在处理先生.西蒙·谢泼德(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.

这篇关于如何告诉forfile在PATH中执行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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