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.
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.
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.
Believe it or not,
EDLIN.EXE is still around
<shudder> at least on this Vista system.
Excuse me while I sob softly to myself...
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.
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.)
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
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.
I'm not 100% sure it will work via SSH as they may use some special Windows API for Console Window management, but on Windows there is a console shell called FAR Manager (similar to Norton Commander or Volkov Commander for MS DOS or Midnight Commander for Linux). You can run the FAR Manager editor using the following command line:
far -E <filename>