T
T
TechNOIR2017-11-03 08:43:05
PowerShell
TechNOIR, 2017-11-03 08:43:05

Powershell. How to solve the problem with exporting to a file?

Good afternoon. I'm trying to export to a file like this:

$result = $ids[$z] + "`t" + $tit[$z] + "`t" + $reg[$z] + "`t" + "0" + "`t" + "0"
        Out-File -InputObject $result -FilePath E:\3\vkk.txt -Append

$tit[$z], $reg[$z] have text values. This is the name of the city and the name of the region.
Export returns error:
Не удается преобразовать значение "Москва" в тип "System.Int32". Ошибка: "Входная строка имела неверный формат."

Any ideas, fellow experts? thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TechNOIR, 2017-11-03
@TechNOIR

Clumsy (like all code), but I decided it myself)

$id = $ids[$z]
$result = "$id" + "`t" + $tit[$z] + "`t" + $reg[$z] + "`t" + "0" + "`t" + "0"
        Out-File -InputObject $result -FilePath E:\3\vkk.txt -Append

E
Ethril, 2017-11-03
@Ethril

$result = [string]$ids[$z] + .........

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question