hello i'm trying to study powershell and need help in incredibly simple operation. I work in bash and never thought that will stuck on redirecting loop output to file
i tried :
for ($i=0; $i -le 10; $i++) {write-host $i} ) > file
or | out-file file
or | Tee-Object filetried to make it through function
function fps () {for ($i=0; $i -le 10; $i++) {write-host $i} )} > file
or | out-file file
or | Tee-Object filetried to pipe redirection inside function
{write-host $i | out-file file
or
Tee-Object file
}
and didn't get any result except empty output file
How come that it doesn't work??? What crazy logic should i use to just get a file with {1..10}???
I googled about ps loop redirection but found only weird and way to much complicated solutions for such a basic stuff!!!
Please help my guys!!!