This topic contains 6 replies, has 4 voices, and was last updated by
January 15, 2017 at 11:52 am #61983ParticipantPoints: 0Rank: Member
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.
January 15, 2017 at 12:29 pm #61986
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. 😉
January 15, 2017 at 2:44 pm #61987ParticipantPoints: 0Rank: Member
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.
January 15, 2017 at 3:14 pm #61989
January 15, 2017 at 3:20 pm #61990KeymasterPoints: 1,811Rank: Community Hero
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.
January 15, 2017 at 4:06 pm #61992
January 15, 2017 at 4:50 pm #61993ParticipantPoints: 0Rank: Member
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.
The topic ‘Editing a file from powershell’ is closed to new replies.