Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Newbie : powershell file creation ...

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-10-2007   #1 (permalink)
sko002
Guest


 

Newbie : powershell file creation ...

hi,
I just installed powershell on my pc (which has the required configuration)
but i can not even make simple task like file creation such as :

PS W:\> "hello !" | Out-File c:\test.txt

It returns this error below :

Out-File : Unknown error "-1".
At line:1 char:21
+ "hello !" | Out-File <<<< c:\test.txt

I have searched for such topic on the web but nothing...
Someone can help please ? Thanks.



My System SpecsSystem Spec
Old 10-10-2007   #2 (permalink)
Klaus H. Probst
Guest


 

Re: Newbie : powershell file creation ...

sko002 wrote:
Quote:

> hi,
> I just installed powershell on my pc (which has the required configuration)
> but i can not even make simple task like file creation such as :
>
> PS W:\> "hello !" | Out-File c:\test.txt
Well really, this is no different than plain cmd.exe:

WPS> "Hello" > c:\test.txt

Simple, no? =)

Also:

WPS> get-help set-content

--
Klaus H. Probst
http://www.simulplex.net/
My System SpecsSystem Spec
Old 10-10-2007   #3 (permalink)
Jeff
Guest


 

Re: Newbie : powershell file creation ...

On Oct 10, 1:07 pm, sko002 <sko...@xxxxxx> wrote:
Quote:

> hi,
> I just installed powershell on my pc (which has the required configuration)
> but i can not even make simple task like file creation such as :
>
> PS W:\> "hello !" | Out-File c:\test.txt
>
> It returns this error below :
>
> Out-File : Unknown error "-1".
> At line:1 char:21
> + "hello !" | Out-File <<<< c:\test.txt
>
> I have searched for such topic on the web but nothing...
> Someone can help please ? Thanks.
There isn't anything wrong with what you are trying to do. Is it
possible you don't have the proper permissions to write to C:\? Try
creating the file with redirection, and see if you get the same
result:

"hello !" > c:\test.txt

Jeff

My System SpecsSystem Spec
Old 10-10-2007   #4 (permalink)
sko002
Guest


 

Re: Newbie : powershell file creation ...

Hi Klaus,
Sorry I may be unclear in my problem description.
I wanted to use powershell for some tasks that cmd.exe can not do or do it
easier at least !

My problem is that powershell returns an error when I execute simple command
like : "hello !" | Out-File c:\test.txt ...

do you see what i mean ?!



"Klaus H. Probst" wrote:
Quote:

> sko002 wrote:
Quote:

> > hi,
> > I just installed powershell on my pc (which has the required configuration)
> > but i can not even make simple task like file creation such as :
> >
> > PS W:\> "hello !" | Out-File c:\test.txt
>
> Well really, this is no different than plain cmd.exe:
>
> WPS> "Hello" > c:\test.txt
>
> Simple, no? =)
>
> Also:
>
> WPS> get-help set-content
>
> --
> Klaus H. Probst
> http://www.simulplex.net/
>
My System SpecsSystem Spec
Old 10-10-2007   #5 (permalink)
Kiron
Guest


 

Re: Newbie : powershell file creation ...

Could you check the version installed, both outputs should be 1.0.0.0:

(Get-Command Out-File).dll -replace '^.+((\d+\.){3}\d+).+$', '$1'
"$((Get-Host).version)"

--
Kiron
My System SpecsSystem Spec
Old 10-10-2007   #6 (permalink)
sko002
Guest


 

Re: Newbie : powershell file creation ...

Hi Jeff,

I have admin permissions on my PC ...

Same error with redirection :
PS C:\> "hello !" > c:\test.txt
Unknown error "-1".
At line:1 char:12
+ "hello !" > <<<< c:\test.txt


"Jeff" wrote:
Quote:

> On Oct 10, 1:07 pm, sko002 <sko...@xxxxxx> wrote:
Quote:

> > hi,
> > I just installed powershell on my pc (which has the required configuration)
> > but i can not even make simple task like file creation such as :
> >
> > PS W:\> "hello !" | Out-File c:\test.txt
> >
> > It returns this error below :
> >
> > Out-File : Unknown error "-1".
> > At line:1 char:21
> > + "hello !" | Out-File <<<< c:\test.txt
> >
> > I have searched for such topic on the web but nothing...
> > Someone can help please ? Thanks.
>
> There isn't anything wrong with what you are trying to do. Is it
> possible you don't have the proper permissions to write to C:\? Try
> creating the file with redirection, and see if you get the same
> result:
>
> "hello !" > c:\test.txt
>
> Jeff
>
>
My System SpecsSystem Spec
Old 10-10-2007   #7 (permalink)
sko002
Guest


 

Re: Newbie : powershell file creation ...

Hi Kiron,
Yes same version !

PS W:\> (Get-Command Out-File).dll -replace '^.+((\d+\.){3}\d+).+$', '$1'
1.0.0.0
PS W:\> "$((Get-Host).version)"
1.0.0.0



"Kiron" wrote:
Quote:

> Could you check the version installed, both outputs should be 1.0.0.0:
>
> (Get-Command Out-File).dll -replace '^.+((\d+\.){3}\d+).+$', '$1'
> "$((Get-Host).version)"
>
> --
> Kiron
>
My System SpecsSystem Spec
Old 10-10-2007   #8 (permalink)
Kiron
Guest


 

Re: Newbie : powershell file creation ...

Try this:

powershell -noProfile {"hello !" | Out-File c:\test.txt}

--
Kiron
My System SpecsSystem Spec
Old 10-10-2007   #9 (permalink)
sko002
Guest


 

Re: Newbie : powershell file creation ...

damn ! Still the same !!! : (

PS W:\> powershell -noProfile {"hello !" | Out-File c:\test.txt}
Out-File : Unknown error "-1".
At line:1 char:21
+ "hello !" | Out-File <<<< c:\test.txt



"Kiron" wrote:
Quote:

> Try this:
>
> powershell -noProfile {"hello !" | Out-File c:\test.txt}
>
> --
> Kiron
>
My System SpecsSystem Spec
Old 10-10-2007   #10 (permalink)
Kiron
Guest


 

Re: Newbie : powershell file creation ...

It is very odd sko002. I've never heard of 'unknown error "-1"'. You have the right version and you tried executing from a PowerShell session without user Profile... but the error persists. I can't think of any other suggestion than to either wait, there are very knowledgeable members on this group that can help; or unisntall PowerShell, download the version for your platform again and reinstall it.

Sorry I couldn't help more.

--
Kiron
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie: WMI and Powershell Jeff PowerShell 5 10-11-2007 11:24 AM
Newbie to Powershell Angelo PowerShell 1 07-04-2007 04:28 PM
Newbie Question - Uses for PowerShell Kim Finleyson PowerShell 11 06-28-2007 07:20 PM
Newbie to PowerShell Nik PowerShell 3 04-06-2007 05:21 PM
newbie - How to use FTP in powershell Andy.I PowerShell 2 02-12-2007 05:23 AM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008