Nano alternative for windows powershell

I am looking for software similar to nano for linux bash but for windows powershell. Is there any built in so I do not have to install something?

EDIT Nano is a text editor that runs within the bash. You can open a text like document (.txt, .c etc) in the bash to edit it on the fly or just view it and close it again.

• I don't know if this works but maybe it's possible to get edit.com off an XP machine and use it in powershell on windows 7. I don't know if Win7 32bit has edit.com but win7 64bit doesn't have edit.com – barlop Jul 8 '15 at 22:14
• Assume someone knows everything about PowerShell and could help you, but doesn't know much about Linux or what Nano may be. Maybe you should describe what you want to do. – Peter Hahndorf Jul 9 '15 at 2:45
• @PeterHahndorf You were right, I edited it – John Demetriou Jul 9 '15 at 6:25

There is now a way to use nano and vim with powershell by installing "Bash on Windows". More information on Scott Hanselman blog

From command line you can run

bash -c "vi filename.txt"
bash -c "nano filename.txt"


function vi ($File){ bash -c "vi$File"
}

function nano ($File){ bash -c "nano$File"
}


The blog source where I got the information from

• Those smart quotes in your post will become stupid to the shells and cause problems. I've fixed them for you this time – phuclv Oct 17 '17 at 3:25
• Yes. Since powershell has been updated. Thank you for the updated answer, I swapped the accepted one to yours – John Demetriou Oct 17 '17 at 8:25

Nano is available for powershell. If you have the Chocolatey package manager installed in your system you can install nano with:

choco install nano


You can install Chocolatey through the command line with:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))


My personal experience is that it nano performs great in Windows 10 but it's really slow to start up the first time in Windows 7.

The only built-in editor in Windows is Notepad. It should already be in your path, so you can just type notepad something.txt in the PowerShell console.

If you want console-based editors, there are some here: https://stackoverflow.com/questions/11045077/edit-a-text-file-on-the-console-in-64-bit-windows

A useful thing to do is to make an alias called "edit" (for example) for your favorite text editor. Put something like this in your profile:

set-alias edit "\${env:ProgramFiles}\Sublime Text 3\sublime_text.exe"

• Newer versions of Windows also have powershell_ise.exe built-in and in the path. A pretty good editor for PowerShell scripts. – Peter Hahndorf Jul 9 '15 at 7:24
• so no built in powershell editor inside the shell? only external programs that run outside of powershell? – John Demetriou Jul 9 '15 at 7:30
• @John Demetriou, I'm not sure what you mean by "built in" now. There are two stock text editors that come with Windows: Notepad and PowerShell ISE (thanks Peter). If you want a console-based editor, then the link above has some. There is no stock, console-based editor in recent versions of Windows. – dangph Jul 9 '15 at 7:43
• that's what I meant, stock console based editor. ok thanks. I will look in the link you provide and choose. thanks – John Demetriou Jul 9 '15 at 7:58
• To use the ISE editor: psEdit \path\to\file.txt ... To switch back and forth between the editor and powershell ctrl + s and ctrl + d – Kolob Canyon Jan 17 '17 at 23:54

Just install Windows Subsystem for Linux (WSL). Then, type.

wsl nano


or

wsl nano textfilenametoedit.txt


Quotes are not needed.

• This may be obvious to some people, but it tripped me up for a bit: if you're supplying a full path to the file, make sure you pass the path that you would use in WSL, not in Windows. For example, if you want to edit C:\text.txt, instead of using wsl nano C:\text.txt, use wsl nano /mnt/c/text.txt – Matt Apr 12 '19 at 18:30

To add to the answers you've already received, you can have a shell editor in Windows, by installing Vim for windows, from Vim's official page.