Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 33 down vote accepted

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.

share|improve this answer
On all versions of Windows? There is no "edit" on Windows 7 apparently. – Snark Sep 10 '10 at 3:53
Odd... evidently it's installed by default on Windows 7 32-bit, but not on Windows 7 64-bit. That's sad. – nhinkle Sep 10 '10 at 4:12
This command only freezes when I try to call it! – Casebash Sep 10 '10 at 4:18
@nhinkle: I seem to recall reading something about 16-bit apps being unavailable under 64-bit windows installs. – intuited Sep 10 '10 at 4:34
It doesn't work on win8 x64. – Jo Smo Feb 28 '14 at 13:58

The simplest solution on all versions of windows is:

C:\>notepad somefile.txt

And, no extra software required.

share|improve this answer
Nice, but not over SSH – Casebash Sep 10 '10 at 4:10
Ah. Right. Windows doesn't have a command-line editor built in. You'll probably need to install the Gnu version of the editor you want to use. Since you've already installed the ssh server, that should be no problem for you. – BillP3rd Sep 10 '10 at 4:27
Like BillP3rd said... just run cmd as administrator, then enter notepad filename, save it and that's it. ;) – Jo Smo Feb 28 '14 at 13:57
Like OP said... "I am actually trying to edit files over ssh..." – daviewales Apr 13 '14 at 3:16
My biggest problem with notepad is it doesn't handle different style newlines. – wisbucky Oct 1 '14 at 19:15

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.

share|improve this answer
Hard core. Try not to make any typos, or you'll have to start over again. Well, backspace does work if you catch the mistake before you press Enter. – Kevin Panko Dec 3 '13 at 18:57
Doesn't seem to work with psexec. Tried to edit my hosts file with copy con hosts but ^Z doesn't save and ^C doesn't cancel! Had to close the cmd window to get out. The file was unchanged. – Iain Elder May 27 '14 at 11:17
Note: F6 can be used instead of [Ctrl]-[Z] – MonoThreaded Sep 13 '14 at 9:58

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.

share|improve this answer

Believe it or not, EDLIN.EXE is still around <shudder> at least on this Vista system.

Excuse me while I sob softly to myself...

share|improve this answer
It was finally deleted in Windows 7 (at least the 64-bit versions). – paradroid Sep 10 '10 at 7:11
@jason404: It's still included in 32-bit Windows 7. – Dennis Williamson Sep 10 '10 at 15:08
edlin is a 16-bit program, therefore it is not available in 64-bit versions of Windows. However, I won't be surprised if someone here claims it's still present in the 32-bit version of Windows 10. – TSJNachos117 May 12 '15 at 7:54

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.

share|improve this answer

protected by slhck May 24 '15 at 16:40

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.