简体   繁体   English

Visual Studio Post-build事件:用于(set)命令中的%f

[英]Visual Studio Post-build event: for %f in (set) command

This command in the Visual Studio 2010 Post-build event Visual Studio 2010 Post-build事件中的此命令

for %f in ("$(ProjectDir)$(OutDir)*.dll") do echo %f

( echo will be replaced with some other tool) gives me the error echo将被其他一些工具取代)给我错误

The command "[...]" exited with code 255.

I guess I have to escape the outermost round brackets but I don't know how. 我想我必须逃离最外面的圆括号,但我不知道如何。 I tried \\( and (( . 我试过\\(((

You might need to use %%f instead of %f for the first one (and maybe the second one). 对于第一个(可能是第二个),您可能需要使用%% f而不是%f。 In a batch file (which VS might use to implement these custom build steps), you have to use the extra % for identifiers. 在批处理文件(VS可能用于实现这些自定义构建步骤)中,您必须使用额外的%作为标识符。

Edit: here's the first part of the output from help for on the command line. 编辑:这是命令行help for输出的第一部分。

Runs a specified command for each file in a set of files. 为一组文件中的每个文件运行指定的命令。

FOR %variable IN (set) DO command [command-parameters] FOR%变量IN(设置)DO命令[命令参数]

%variable Specifies a single letter replaceable parameter. %variable指定单个字母可替换参数。 (set) Specifies a set of one or more files. (set)指定一组一个或多个文件。 Wildcards may be used. 可以使用通配符。 command Specifies the command to carry out for each file. command指定要为每个文件执行的命令。 command-parameters Specifies parameters or switches for the specified command. command-parameters指定指定命令的参数或开关。

To use the FOR command in a batch program, specify %%variable instead of %variable. 要在批处理程序中使用FOR命令,请指定%% variable而不是%variable。 Variable names are case sensitive, so %i is different from %I. 变量名称区分大小写,因此%i与%I不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 生成后事件错误Visual Studio 2008 - Post-build Event error visual studio 2008 如何在Visual Studio的post-build事件中获取解决方案目录的动态路径 - How to get the dynamic path of solution directory in post-build event of Visual Studio 通过 NuGet 提供命令行工具以在 Visual Studio 中的生成后事件中使用 - Deliver command-line tool via NuGet for use in post-build events in Visual Studio Visual Studio生成后事件和批处理命令 - Visual Studio Post-Build Events and Batch Commands 使用VS post-build event命令执行令牌替换? - Perform token replacements using VS post-build event command? Dotfuscator生成后事件以代码1退出 - Dotfuscator Post-Build Event Exited With Code 1 在MonoDevelop和Visual Studio上使用post-build脚本制作项目的最佳方法是什么? - Best way to make a project with post-build script work on MonoDevelop and Visual Studio? 之前/之后的构建事件Visual Studio - pre/post build event Visual Studio 通过Visual Studio 2008中的生成后事件为多个命令添加XCopy命令 - Adding XCopy command through Post Build Event in Visual Studio 2008 for multiple commands 在使用MEF时是否有任何Prism“Post-build”事件或方法? - Are there any Prism “Post-build” Event or method while using MEF?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM