Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 文件名目录名或卷标语法不正确_Batch File - Fatal编程技术网

Batch file 文件名目录名或卷标语法不正确

Batch file 文件名目录名或卷标语法不正确,batch-file,Batch File,我在VS2010中的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\xx

我在VS2010中的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

我发现问题在于我的批处理文件是Unicode(VS2010中的默认文本文件)


文件>高级保存选项并更改为西部解决了该问题。

您好,我无法确定它在什么时候失败,因为我可以在生成完成后的生成结果后看到该错误。当我看到构建结果时,这个错误在构建执行完成后出现。谢谢。在记事本++中选择ANSI编码也对我有用。