On Unix I'd just use vi, but I don't know what the command is on Windows. I am actually trying to edit files over SSH with Windows Server 2008.
14 Answers
The simplest solution on all versions of Windows is:
C:\> notepad somefile.txt
And, no extra software required.
- 12,326
- 6,599
From a Windows command prompt enter copy con followed by the target file name. (copy con c:\file.txt).
Then enter the text you want to put in the file.
End and save the file by pressing CTRL-Z then Enter or F6 then Enter.
If you want to change text in an existing file simply display the text by using the command type followed by the file name and then just copy and paste the text in to the copy con command.
- 12,326
- 787
- 5
- 3
edit filename
I won't vouch for its functionality and outdated GUI but it is installed by default, even on Windows 7.
Edit: Except 64 bit versions of Windows.
- 17,427
If you have git installed for windows then most likely nano and vim are both available at
C:\Program Files\Git\usr\bin\nano.exe
C:\Program Files\Git\usr\bin\vim.exe
To run from a command prompt (cmd.exe)
"c:\Program Files\Git\usr\bin\nano.exe" <filename>
To run in powershell
& 'C:\Program Files\Git\usr\bin\nano.exe' <filename>
They both work great even over ssh.
If you're used to vi and don't want to settle for the built-in editor you can get Vim for Windows. It'll run from a command shell. Or try WinVi.
- 12,326
- 8,551
Believe it or not, EDLIN.EXE is still around <shudder> at least on this Vista system.
Excuse me while I sob softly to myself...
- 111,445
I don't know about SSH, or anything (else?) server-related, so forgive me if this "solution" is useless. If you want to edit files in the command prompt, you can get the Windows version of Nano.
As a side note, those little ^ signs at the bottom of the window are supposed to represent the Ctrl button. For instance, ^X Exit means that you can exit the program using Ctrl-X.
Also, Nano will sometimes add extra newlines when saving files. This seems to be some kind of bug with Nano's word wrapping.
I've also seen ports of vi for Windows, although I've used one that just seem to make command prompt window as small as it can be, leaving only a title bar (which means the rest of the window may as well be invisible, since you can't see what you're doing). However, the Windows version of Vim seems to work quite nicely.
- 12,326
- 321
2020 UPDATE:
On Win10 just enable the linux subsystem then you'll have most of the linux stuff like vim and nano:
c:> bash
$: nano yourfile.txt
- 759
Use vim or nano.
Install vim with with choco install vim using the chocolatey package manager.
(There might be Scoop version available as well, but I haven't checked.)
Although nano also exists as choco package, it is very outdated. Instead manually install this nano. However, when using over SSH, nano control characters get a bit confused, so you may lose some, since windows use it's own API for controlling screen characters, and not POSIX. So although a lot of work is currently in progress for future Win10 compatibility.
Then you can run with: nano -cg some.txt, but the cursor will only show up at the right location when you push CTRL-L. (Which is why vim is preferred.)
- 2,651
- 4
- 34
- 45
2021 UPDATE
As @phuclv has mentioned in comments, I want to emphasize that there is a tool that actually works great on Windows 64 bit too! It's called Micro and fortunately, it is quite feature-rich, regularly updated and alive.
To install it, you only need to download the latest version's 64bit.zip file from here, and then unzip it somewhere and add its path to your PATH. No dependencies or external files are needed — just the binary and you're done.
Quick Start:
- Just type
microto create and edit a new text file. - Type
micro <filename>to start editing an already-made file. - To save:
ctrl + s - To see a list of keybindings:
alt + g - To quit:
ctrl + q
Some Exciting Features:
- Select text easily (using the shift key, or even using your mouse!), and then copy, cut, paste or delete the selected text using the same keybindings common in your operating system(e.g.
ctrl + cfor copy on Windows). - Supporting so many common keybindings, e.g.
ctrl + dto duplicate a line, or activate multiple curser mode and etc. - Undo / Redo
- Syntax Highlighting (for more than 130 programming languages)
- Plugin System
- Typed Commands (instead of using keybindings)
- ...
A tip on using Micro for VSCode users:
Since both VSCode and Micro try to support all common keybindings, you'll probably have a lot of conflicting keybindings between them when using Micro inside the VSCode's embedded CMD/PowerShell terminal. For instance, to quit Micro, you will have to use ctrl + q while it is the VSCode's keybinding for the "Quick Open View" command.
But no worries! Micro also supports "Typed Commands" which allow you to control the editor using commands instead of keybindings. So you can type commands and you're fine to use Micro on VSCode as well. However, there's still a tiny problem. To enable "command mode" on Micro, you have to use ctrl + e, which is also a keybinding of VSCode for the "Go To File..." command. So you have to change the ctrl + e keybinding either on VSCode or on Micro to get rid of this conflict and then you're all set.
Personally, I preferred to change Micro's ctrl + e. Here are the steps from the documentation to change it to ctrl + w (or whatever else non-conflicting keybinding of your own liking) on a Windows machine:
- Open
%userprofile%/.config/micro/bindings.jsonwith any editor. - Add this line to the end of the JSON:
"Ctrl-w": "CommandMode" - Save.
Now to enter command mode, press
ctrl + wand type your commands (e.g.: quit, save, open, etc).
- 294
There is a console file manager called FAR Manager (similar to Norton Commander or Volkov Commander for MS DOS or Midnight Commander for Linux).
You can run the internal FAR Manager text editor using the following command line:
far -E <filename>

@Joril says it works via SSH. I did not have chance to test it.
Another similar solution is to install Midnight Commander as part of the msys2 distro or the standalone app and run
mcedit <filename>
- 235
In the latest Windows 10 & 11, you can install Nano/vim/micro directly from Windows Terminal:
winget install Gnu.Nano
winget install vim.vim
winget install zyedidia.micro
- 188
If the remote computer has Windows Subsystem for Linux installed, you can type bash to have the next commands interpreted by WSL. From here, you can type nano FILENAME or vim FILENAME or whatever your preferred Linux text editor is. To exit WSL and return to regular Command Prompt, type exit or logout.
This came in handy when I was accessing a Windows Jupyter Notebook server and wanted to edit .gitattributes, a hidden file which isn't shown in the Jupyter GUI. This answer is based on SajanGohil's comment above.
- 522
There is now Microsoft Edit. It will soon be shipped with Windows 11.
Quick install:
winget install Microsoft.Edit
- 292

