Editing a file from powershell

This topic contains 6 replies, has 4 voices, and was last updated by  James Krusic 1 year, 4 months ago.

  • Author
  • #61983



    i am a newbie regarding powershell, i have searched the internet with no luck.

    my question is, is there a way to open a text file inside powershell and edit it live?

    for instance, instead of typing: notepad c:\textfile.txt
    a window of the textfile opens, edit it, click save and close.
    just to open the contend inside powershell, edit them there, and click save somehow.

    i remember, back when i was a student, in linux was possible, can't figure out how to do it in a powershell,

    thanks in advance.

  • #61986

    Olaf Soyk

    Hmmm ... what did you search for? It's hard to believe that you don't find one of the simplest tasks. You might start learning the Powershell basics. Here are some great free sources to look at:


    BTW: A quick Google search for "powershell edit text file line" brought up this as the first hit:


    So you might even improve your search skills a little bit. 😉

    • #61987


      thank you for your answer, but this not what i am looking for.

      i do not want to replace, change, delete or in general do something to a text file.

      i want the text file and it's contents to been shown inside powershell, and have the full control
      of the content inside powershell to edit them (do whatever i want using my mouse, or arrows to navigate)

      it's like having notepad in front of me, but powershell instead.

  • #61989

    Olaf Soyk

    Why do you want to do Powershell the job of an editor? That doesn't make that much sense for me.

    To show the content of a text file you can use the cmdlet Get-Content.

  • #61990

    Don Jones

    PowerShell doesn't have anything like Nano or Vi, no. That's more a lack of Windows than PowerShell per se; PowerShell is just a command language. Windows hasn't really ever had a console editor. I haven't looked to see if some third party has made one or not, but that might be an option.

  • #61992

    Olaf Soyk

    If you're looking for an IDE – the Powershell_ISE comes with Powershell or the MS Visual Studio Code with the Powershell extension does a good job I think.

  • #61993

    James Krusic

    So vi would be like psedit inside powershell ise using v5. Vi just opens the item to be edited inside the vi component much like editing a script inside ise.

You must be logged in to reply to this topic.