Newbie : powershell file creation ...


  1.    10 Oct 2007 #1
    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

  2.    10 Oct 2007 #2
    Klaus H. Probst Guest

    Re: Newbie : powershell file creation ...


    sko002 wrote:

    > 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

  3.    10 Oct 2007 #3
    Jeff Guest

    Re: Newbie : powershell file creation ...


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

    > 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

  4.    10 Oct 2007 #4
    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:

    > sko002 wrote:

    > > 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

  5.    10 Oct 2007 #5
    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

  6.    10 Oct 2007 #6
    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:

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

    > > 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

  7.    10 Oct 2007 #7
    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:

    > 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

  8.    10 Oct 2007 #8
    Kiron Guest

    Re: Newbie : powershell file creation ...


    Try this:

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

    --
    Kiron
      My System SpecsSystem Spec

  9.    10 Oct 2007 #9
    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:

    > Try this:
    >
    > powershell -noProfile {"hello !" | Out-File c:\test.txt}
    >
    > --
    > Kiron
    >
      My System SpecsSystem Spec

  10.    10 Oct 2007 #10
    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

Page 1 of 4 123 ... LastLast
Newbie : powershell file creation ...

Similar Threads
Thread Forum
Newbie Powershell help in batch file
Hi, I am new to creating batch files and to powershell. Basically I found some code and adapted it to allow me to create a scheduled task on...
General Discussion
Powershell Newbie
Hi, I'm now to this forum, hi to everyone. I normally use command prompt and have now decided to use powershell. I have the following script:- ...
PowerShell
powershell newbie help
Hi all, I am relatively new to powershell, so please bear with me here. I would like to write a simple PS script that searches within a given...
PowerShell
Newbie: WMI and Powershell
I am running the following command from the powershell command line: PS C:\Users\jpoling> Get-Content c:\scripts\servers.txt | Foreach-Object...
PowerShell
Newbie to Powershell
Hello All, I am new to powershell and was wondering if someone could show me how to get information on CPU usage on a remote server on my Xp...
PowerShell
Newbie to PowerShell
Hey Can anyone guide me to where I can find a Free PowerShell Tutorial. I am currently using kiXtart to script, but am interested in learning...
PowerShell
newbie - How to use FTP in powershell
Hi Are there any built in cmdlets with ftp support, or should I use the ftp.exe in a powershell script to move and copy files to an ftp server?...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 12:52.
    .