PowerShell Issue with Get-Content


I have an issue. When I run a command:

powershell -command “gc C:\Program Files\Microsoft SQLServer\MSSQL.1\MSSQL\LOG\ERRORLOG -totalcount 5

There is an error:

“Get-Content : A positional parameter cannot be found that accepts
argument ‘Files\Microsoft’. At line:1 char:3 + gc <<<< C:\Program
Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG -to talcount 5
+ CategoryInfo : InvalidArgument: (:) [Get-Content], ParameterBindingException

Can you help me with that?


Always put your path between quotes when it contains spaces.


PowerShell Issue with Get-Content by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply