I'm a (very new) beginner with powershell and need help inputting a code that will add a comma and numerical increment to each line of output which would be a random number. The output is displayed in a file.
$file = "path to file"
for ($i=0; $i -le 4; $i++) {
$a = Get-Random -Minimum 10 -Maximum 50
Add-Content $file $a.ToString("0")
}
so the output of this would be 1 line for each random number such as:
12
30
22
41.. etc
I'd like it to look like this:
1,12
2,35
3,22
4,41
Can anyone please provide a code that would make this happen? any help would be much appreciated.