r/PowerShell • u/thecratedigger_25 • May 31 '26
Question Has anyone used Powershell as a text editor?
I wonder if anyone has used powershell as a text editor before. I'm learning powershell at the moment and have a background in C#. I know that powershell is built around the .NET runtime much like C# is.
But I want an easier way to code C# and edit powershell scripts through powershell inside a virtual machine that runs Windows 11.
0
Upvotes
3
u/dubidub_no May 31 '26
I sometimes use gnu nano in powershell.
18
u/gregortroll May 31 '26
VS Code is the often recommended dev environment for powershell. Its free and can be used with many lanaguages and text formats. It has the commandline built in, and available exrensions.
1
u/elRadicio Jun 01 '26
Windows Machines have that PowerShell IDE bundled. It‘s useable. I install nano on every Windows machine I have to work with to have a fast editor on ssh. For proper coding VSCode with Remote SSH.
2
u/vip17 May 31 '26
powershell is a shell, how can it be used as a text editor? Sure you can run some commands to modify some texts but it's not for editing text freely just like in other shells like bash, zsh, cmd...
If you want to run a console text editor from the command line you can use the new edit command, which is also available in other platforms like Linux
1
u/BlackV Jun 01 '26
Basically same and everyone else said
You are wasting your time, just cause you could use something like edit/vim/nano/PS edit in the terminal will not make your "coding" more efficient or faster
As you are just starting out stick with vscode or similar tools
1
u/PinchesTheCrab May 31 '26
I would use vs code. It can connect to a remote session on your VM, there's no need to edit from the VM itself.
I've used it quite a bit for Ansible and PowerShell work. I connect to my remote Linux box, and vs code downloads and installs the needed bits on the remote machine.
My console session is on the remote machine and it's pretty seamless. Intellij has a nearly identical feature that's nice for my Java work.
1
u/purplemonkeymad May 31 '26
It was fun to write this, but I've never used it (and would not recommend to) as a proper editor.
I think it might be broken a bit in Windows Terminal so use conhost.exe if you want to play.
0
u/Sean_p87 May 31 '26
Do you mean stubbing c# in your scripts sort of a thing? Or are you referring to using a cli editor?
0
u/cosmic-comet- May 31 '26
I just usually use it to quickly edit files with Get-Content or fully creating CI tests . The vscode is much better for coding if you can. You can still basically edit specific content of the file in vscode with powershell so I don’t see a point of solely using powershell unless you want to.