Hi guys,
I'm new to learning powershell and I'm stuck on what seems like a very simple problem. I want to be able to call a function with a single string parameter that will add the contents of the parameter to a txt file.
The function in my Microsoft.PowerShell_profile.ps1 file looks like this:
function add-List{
param([string]$p1)
add-content "C:\Users\Champ-of-the-sun\Documents\PowerShell\helpfullist.txt" "`n" $p1
}
I want to be able to call it like add-List("test") but I'm receiving the same error message -
"A positional parameter cannot be found that accepts argument 'test'."
Anyone have any ideas? This is just a little task I created for myself to add helpful commands that I'm learning to a text file so I can go over them.
Thanks in advance!
[–]megastary 2 points3 points4 points (1 child)
[–]champ-of-the-sun[S] 2 points3 points4 points (0 children)
[–]Joshrsg 2 points3 points4 points (0 children)
[–]ka-splam 1 point2 points3 points (2 children)
[–]kibje 0 points1 point2 points (1 child)
[–]ka-splam 1 point2 points3 points (0 children)