我在 PowerShell 中有一个脚本,用于从 CSV 导入数据。我收到错误
无法将值“日记帐金额”转换为类型“System.Double”。错误:“输入字符串的格式不正确。” 在 C:\TestPowerShell\TestPowerShell1.ps1:98 char:1 + $JournalAmount = [double] $_.PSObject.Properties['Journal Amount'].Va ... + ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + CategoryInfo:InvalidArgument:(:) [],RuntimeException + ExcellentQualifiedErrorId:InvalidCastFromStringToDoubleOrSingle
Get-Content "config.txt" | foreach-object -begin {$h=@{}} -process { $k = [regex]::split($_,'='); if(($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) { $h.Add($k[0], $k[1]) } }
$FileBrowserInitialDir = $h.FileBrowserInitialDir
$Header = 'Terminal','Company','Journal Account Code','Project','Task','Line of Business','Date','Journal Amount','Report Entry Vendor Description'
$TIDataFilePath = $h.TIDataFilePath
$TIDataFileBaseName = $h.TIDataFileBaseName
$TIScreenID = $h.TIScreenID
$TIControlFile = $h.TIControlFile
$TIErrLog = $h.TIErrLog
$ResultsFilePath = …Run Code Online (Sandbox Code Playgroud)