我在VS 2010中的TFS构建之后运行这个.bat文件。但它抛出一个错误,说“文件名目录名或卷标语法不正确”
我的批处理文件包含以下内容:
REM "*******START :Modify the following sections*******"
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86_amd64
set ProjectPath=C:\Builds\1\xxxx\xxx\Sources
Set PATH=%PATH%;%Windir%\Microsoft.NET\Framework\v4.0
REM "------Move to the Project Folder------"
cd /c %ProjectPath%
cd C:\Builds\1\xxx\xxxx\TestResults
REM "------Find the latest Test Result file------"
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b/a-d/o-d "C:\Builds\1\xxx\xxxx\TestResults\*.trx"') do (
set latesttrxfile=%%a & goto :done
)
:done
echo %latesttrxfile%
REM "------Move to test results folder------"
cd C:\Builds\1\xxx\xxxx\TestResults
REM "------Convert trx to html------"
trx2html "C:\Builds\1\xxx\xxxx\TestResults\%latesttrxfile%"
REM "------Find the latest Test Result html file------"
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b/a-d/o-d "C:\Builds\1\xxx\xxx\TestResults\*.htm"') do (
set latesthtml=%%a & goto :done
)
:done
echo %latesthtml%
REM "------Send Email------"
sendEmail.exe -s xxx.xxx.xxx.com -f yyyy@xxx.com -t yyyy@xxx.com -u Test Report attached -a "C:\Builds\1\xxx\xxx\TestResults\%latesthtml%" -m TestReportAttached
Pause
答案 0 :(得分:3)
我发现问题是我的批处理文件是Unicode(默认情况下是VS 2010中的文本文件)。
档案>高级保存选项并更改为 Western 修复了问题。