I’m calling this from a BAT file:
powershell -nologo -file ./Run-Metrics.ps1 1 1 "RWSConsoleOnly" "batch" "RWSConsoleOnly" 3 "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FXCop\FXCopCmd.exe" "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\" "14" "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\Metrics.exe" "d:\a6\RWS_Test_Batch_XML\Microsoft_Build_XML\trunk"
And I get this error:
Run-Metrics.ps1 : A
positional parameter cannot be found that accepts argument 'Studio'.
+ CategoryInfo : InvalidArgument: (:) [Run-Metrics.ps1], ParentCo
ntainsErrorRecordException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Run-Metrics.ps1
This was working a couple of days ago. I’ve made changes internally to the script but not to the BAT file or the script parameters. The parameters are:
Param
(
# AHP Iteration
[Parameter(Mandatory=$false,Position=0)]
[int]$AHPIteration,
# buildAnalysisCount
[Parameter(Mandatory=$false,Position=1)]
[int]$buildAnalysisCount,
# buildAnalysisNames
[Parameter(Mandatory=$false,Position=2)]
[string]$buildAnalysisNames,
# buildAnalysisTypes
[Parameter(Mandatory=$false,Position=3)]
[string]$buildAnalysisTypes,
# buildAnalysisAsmbs
[Parameter(Mandatory=$false,Position=4)]
[string]$buildAnalysisAsmbs,
# FXCop Level
[Parameter(Mandatory=$false,Position=5)]
[int]$FXCopLevel,
# FXCopCmdPath
[Parameter(Mandatory=$false,Position=6)]
[string]$FXCopCmdPath,
# FXCop Ruleset Path
[Parameter(Mandatory=$false,Position=7)]
[string]$FXCopRulesetPath,
# Visual Studio Version
[Parameter(Mandatory=$false,Position=8)]
[string]$msvsversion,
# Metrics Command Path
[Parameter(Mandatory=$false,Position=9)]
[string]$metricsCommandPath,
# Working Path
[Parameter(Mandatory=$false,Position=10)]
[string]$workingPath
)
Any ideas why I’m getting this error? I’ve tried more quotes around the strings with spaces in the path and that didn’t work. Is there a “best practice” for passing complex strings to a single PS parameters from a BAT file?