Hi,
I am new to powershell and need to use hashes: to read them, to amend them, and to save them again.
I found impressive easy ways to convert string (read from files) into a hash:
$tmp = @" EURUSD=19000000 USDCHF=19000000 GBPUSD=19000000"@
$lastDate = convertfrom-stringdata $tmp
But I haven't found any example or code snippet to write hashes into a file preferable like key=value. Is there only the long way: foreach ... write .. or does exist a 'one liner'?
Well, in powershell, what is the best way to save a hash in order to read it again?
Thanks a lot,
calli
well, a hash is just string data so you could pipe it to Out-File.
Or, in order to save more than one hash in a file, consider adding them to an object and writing objects to a CSV. Here is an example:
$object = 1 | Select-Object "Filename", "Hash"$object.FileName = "bla"$object.Hash = "bla"$object | Export-Csv $home\result.txt$import = Import-Csv $home\result.txt$import.FileName$import.Hash
Cheers, Tobias