Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.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
Powershell脚本:使用新项在TFS服务器上创建文件_Powershell_Tfs - Fatal编程技术网

Powershell脚本:使用新项在TFS服务器上创建文件

Powershell脚本:使用新项在TFS服务器上创建文件,powershell,tfs,Powershell,Tfs,可以使用此命令在本地服务器上创建文件 $msbuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" $ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path New-Item -Path $ScriptDir\NITI_20180402.223.txt -ItemType "file" -Value "This is a text string." 但在TFS服务器

可以使用此命令在本地服务器上创建文件

$msbuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe"
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
New-Item -Path $ScriptDir\NITI_20180402.223.txt -ItemType "file" -Value "This is a text string."
但在TFS服务器上生成此脚本时未创建文件

New-Item -Path $ScriptDir\NITI_20180402.223.txt -ItemType "file" -Value "This is a text string."

我对脚本进行了测试,一切正常

无论您可以尝试什么,请添加以下力量:

如果这仍然不起作用,请共享您的构建定义设置捕获屏幕截图更好,以及日志,以便进一步排除故障


如何在构建脚本中定义变量?您的两个示例不匹配。已修改的问题您的TFS服务器上的powershell版本是什么?尝试新项目-Verbose 4>Logfile.txtNew-Item-Path$ScriptDir\abc.txt-ItemType file-Value这是一个文本字符串-Verbose 4获取错误:找不到接受参数“4”的潜在参数您是否尝试手动指定绝对路径而不是使用$ScriptPath变量?或者输出$ScriptPath的值以查看是否设置了奇怪的内容?@nitiparikh您解决了问题吗?有更新吗?
New-Item -Path $ScriptDir\NITI_20180402.223.txt -ItemType "file" -Value "This is a text string." -Force