How to use a text editor WITHIN the Command Prompt in a Windows OS?

25,380

Solution 1

Vim will work inside the Windows console window if you run it with vim.exe.

If you run it with gvim.exe then it will pop up a graphical window, kind of like Notepad would.

Therefore, you want to type the command vim or vim file_name and you should get what you want.

Make sure your $PATH is set to include the folder with vim.exe.

Solution 2

I always use Cygwin with Git and Vim installed to be like on a Unix term and it works perfectly (with a bashrc and alisases ....) and of course ou can install ruby and irb.

Solution 3

It just depends what editor you install. I like UltraEdit, but it's not free for long-term use. Some people like XPad, which is apparently free. There is a program called "WinVI" which is a Windows editor similar to VI, of course. You just have to decide what type of editor you want. For that matter, you could use the XP EDIT program, just copy it to Win7 from an XP system. However, I'm not sure that there's any advantage to using a text-based "DOS" style editor in Windows 7; it may look retro, but there's not likely to be any upside to it.

I think if I had to recommend something DOS-like, I'd go with Emacs-for-Windows: http://ftp.gnu.org/gnu/emacs/windows/

Whatever editor you want to use, put the installation folder into your PATH variable, which is found with Control Panel > System > Advanced System Settings > click on Environment Variables box. Select the PATH variable, and Edit, to add a colon at the end & then the path to the newly-installed program (i.e. "C:\Program Files (X86)\Editco"

This path change will then allow you to just type the program name, instead of the specific location, i.e. instead of

C:\Program Files (X86)\Editco\Myeditor.exe  filename.ext

you'd just type

Myeditor.exe filename.ext

Solution 4

You could try one of the following options:

Share:
25,380

Related videos on Youtube

user258613
Author by

user258613

Updated on September 18, 2022

Comments

  • user258613
    user258613 over 1 year

    I would like to be able to create and edit the text of a file, all from the command line. No pop-up window (like with notepad), just create the file and start editing. I know this can be done with Nano on Mac.

    My current command line is "Command Prompt with Ruby and Rails," which I'm using on Windows 8. Apparently I have VIM installed, or VI. When I commit to git, I am entered into an excellent text edit space - within my current window. Great! But how do I do it if not committing anything, and just want to >make file>edit file>. Something like >vim file_name.

    So the VIM command would be appreciated. If not available, what else can I install? I tried the Nano binary. I ran the nano.exe and it works, but calling >nano file_name from cmd doesn't work. I already copy-pasted the cygwin1.dll to the folder nano asks for in the readme. No luck. I'm using the WinNT/9x binary, .zip format download.

    I'm using x64 Windows 8 OS.

    • Debra
      Debra over 10 years
      Your post is very hard to follow. You seem to be talking about Windows 8, but then you are talking about VI or VIM (which are normally used in linux), Ruby on Rails, and heaven knows what else. If you are at a command prompt in Windows, you can just type Notepad <filename> and it will either create a new file of that name, or edit if the file exists. If you install another text editor, then you can similarly invoke that from the command line. But if this isn't obvious to you, please try cleaning up your post to keep to the specifics of your system.
    • user258613
      user258613 over 10 years
      Thanks for the feedback, Debra. Notepad <filename> simply initiates another window, which is just the normal notepad app. I want a feature like the "edit <filename>" cmd used to have, which keeps me in my command window. -- Command P for Rails is just like the other MS CMD, they both work on Windows 8. It just has some add-ons, like ruby support and VIM/VI.
    • RBT
      RBT about 5 years
  • willus
    willus over 10 years
    The OP specifically mentions vim and you recommend emacs? To use a sports analogy, that's a bit like recommending to a Redsox fan that they wear a Yankees jersey. :)
  • Debra
    Debra over 10 years
    Well, he said thought he had VI or VIM -installed-, not that he preferred it; in fact, he said he wanted something like the old 'edit' command that ran under 16-bit Windows. So it doesn't seem like he has any strong preference so much as wanting something "DOS-like".
  • MatasLiu
    MatasLiu over 7 years
    I can't seem to find a Windows binary at the link you provide for nano. A Google search turned out empty handed as well. Do you have any idea where I could find a Windows build of it?