如何辨别真假FORFILES对路径执行命令? [英] How to Tell FORFILES to Execute Command on Path?

查看:255
本文介绍了如何辨别真假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"

结果下面的错​​误

Results in the following error

C:\\ Program Files文件\\ Common Files文件\\ Microsoft共享\\ web服务器extensions \\ 12 \\ BIN \\的Stsadm.exe -o addsolution -filenamefoobar.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.

但我想不出为什么。我工作过先生西蒙·谢泼德的优良文档

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天全站免登陆