Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm on Windows Vista and want to create a text file. MS DOS does not recognize edit command. What can I use instead, Windows PowerShell? Can I use notepad?

share|improve this question
    
Are you trying to make a text file from the terminal? You could always just run notepad.exe or something like that. –  maxmackie Apr 15 '11 at 5:27

2 Answers 2

To create a text file at the DOS prompt you can use this command:

  • copy con my_text_file.txt

The word "con" means [to Windows in this case] to use your keyboard as the source.

The next line will just be a blinking cursor that waits for you to type. You can type as much as you like and every Enter keystroke will also be recorded exactly. When you are finished, press CTRL-Z followed by the Enter key.


Alternatively, to initiation creating or editing a text file from the DOS prompt, you can use this command:

  • notepad my_text_file.txt

This will cause Windows Notepad to start editing the file you specified (creating a new one when you save if the file doesn't already exist).

share|improve this answer

Randolf's answer looks good.

One other suggestion. If you are used to *nix environments and want similar functionality out of your CMD you can use plain old Vim:

http://www.vim.org/download.php

there is a Windows port here. One of the options when you install from the Self-installing executable is to create .bat files for command line use. This will install vim.bat to your C:\Windows folder. You can then type vim into your command line and a very basic text interface will appear with instructions to help you get started.

Basic vim syntax:

vim <file-name>

edits or creates file of that name

  • Write = i
  • Stop writing = esc
  • Running commands like save, quit or find: type colon (":")
  • Save = w
  • Quit = q
  • Find = /text to find
  • Delete: hold shift, hold arrow keys to select, press d
  • Delete line: hit esc, then d twice. i to enter write mode again

The best bit about using vim is it's on many different Linux builds and is also available for Mac, so you can move smoothly between operating systems without too much trouble. Unlike Notepad, it also has contextual highlighting for many languages (c++, PHP, Java and more).

You could also try compiling various GNU-type (including Vim) editors under MSYS, although that's a bit more effort:

http://telengard.wordpress.com/2008/09/05/installing-mingw-and-msys-on-windows-xp/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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