在构建事件visual studio 2013中调用批处理 [英] Call batch in build event visual studio 2013

查看:285
本文介绍了在构建事件visual studio 2013中调用批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 visual studio 2013 中编写批处理文件以将文件夹从解决方案复制到另一个文件夹。



我想在构建事件中执行此文件通过此代码

 CALL..\CopyFilesToProducts.bat





它给了我以下错误

错误41命令CALL.. \ _CopyFilesToProducts.bat退出代码9009。

解决方案

最可能的原因是它不是一个完全合格的路径 - 它是一个相对路径,我之前看到过这是VS构建的间歇性问题。更改为完整路径:

 CALLC:\ MyApps \ CopyFilesToProducts.bat

应该治愈它。



我怀疑VS用作相对路径规范的起始点的当前文件夹取决于它作为实际构建操作的一部分需要执行的最后一个操作,但是我不确定。


很抱歉,因为我搜索并追踪后发现,

我没有Visual Studio的问题我的问题是在本地用户环境变量的cmd中,



我找到了两个解决此问题的方法:

1 - 以管理员身份打开Visual Studio



2 - 更改本地用户环境变量路径



右键单击我的电脑>属性>高级系统设置> <环境变量>路径[将值编辑到C:\ Windows \ System32; ]

I write batch file to copy folders from solution to another in visual studio 2013.

I wanna execute this file in build event by this code

CALL "..\CopyFilesToProducts.bat"



It gives me the below error

Error 41 The command "CALL "..\CopyFilesToProducts.bat"" exited with code 9009.

解决方案

The most likely reason is that it's not a fully qualified path - it's a relative path, and I've seen this before as an intermittent problem with VS builds. Changing to a full path:

CALL "C:\MyApps\CopyFilesToProducts.bat"

should cure it.

I suspect that the "current folder" that VS uses as the starting point for the relative path specification depends on the last operation it needed to do as part of teh actual build operation, but I'm not sure.


I am sorry because after I search and trace I found that,
I don't have problem with Visual Studio my problem was in cmd on local user environment variable ,

I found two solutions for this issue :
1 - Open Visual Studio as administrator

2 - changed local user environment variable path

right click on My Computer > Properties > Advanced System Setting > environment variable > Path [Edit value to C:\Windows\System32; ]


这篇关于在构建事件visual studio 2013中调用批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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