Windows 7 Out-file problem

balubeto

Extraordinary Member
Hi

In the PowerShell 2.0 console in Windows 7 SP1, I wrote:

Code:
PS C:\Users\test\Documents\PowerShell> Get-Help * | Get-Help -Detailed | Out-File C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt
Out-File: Can not convert 'System.Object[]' to 'System.String' type required from 'FilePath' parameter. Specified method is not supported.
In line:1 car:43
+ Get-Help * | Get-Help -Detailed | Out-File <<<<  C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt
    + CategoryInfo          : InvalidArgument: (:) [Out-File], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.OutFileCommand
PS C:\Users\test\Documents\PowerShell> Get-Help * | Get-Help -Detailed > C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt
Get-Help : Can not convert 'System.Object[]' to 'System.String' type required from 'Name' parameter. Specified method is not supported.
In line:1 car:22
+ Get-Help * | Get-Help <<<<  -Detailed > C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt
    + CategoryInfo          : InvalidArgument: (:) [Get-Help], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.GetHelpCommand
PS C:\Users\test\Documents\PowerShell>

Where I'm wrong?

Thanks

Bye
 
Well, it's been 3 weeks, so this doesn't matter anyway. I'm CLUELESS of powershell, I don't use "seven" hardly at all, I'm Xp-based. Two things i'd try: put quotes around the outfile argument, and/or replace pipe with redir:
C:\Users\test\Documents\PowerShell> Get-Help * | Get-Help -Detailed >"C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt"
or:
C:\Users\test\Documents\PowerShell> Get-Help * | Get-Help -Detailed | Out-File "C:\Users\test\Documents\PowerShell\PowerShell_2,0_Guide.txt"

Not knowing jiz about ps, this is all I can suggest. I have seven, but haven't used it.
 
I'm a PowerShell guy :)

First question, why are you piping the output of one help command to another?
Code:
Get-Help * | Get-Help -Detailed

Another thing, don't use hardcoded paths, use environment locations:
Code:
"$env:UserProfile\Documents\PowerShell\PowerShell_2,0_Guide.txt"

Here's what you want:
Code:
Get-Help * | Format-Table Name, Category, Synopsis | Out-File "$env:UserProfile\Documents\PowerShell\PowerShell_2,0_Guide.txt"
 
Back
Top