Ever tried to ls or rm under Windows?
With just a few minor adjustments the Windows Command Prompt (cmd.exe) can emulate the behaviour of your favourite *nix shell. Please note, this isn’t a full emulation method – the existing Windows commands are being manipulated to appear as their *nix shell counterparts.
Continue reading Emulating *nix Shell with Windows Command Prompt
Writing directly from the Windows command line to a file might not be something you need to do very often. The famous black and white console is better suited to serving system commands and file operations than being a stand-in for notepad. However, it is sometimes useful to have the option of writing multiple lines of text to a file directly from the trusty prompt.
This is suitable for creating/overwriting a file with multiple lines of text.
copy con SOME_FILE.txt
Type your text here
You can even have multiple lines!
When finished, press CTRL+Z to confirm your action (or CTRL+C to cancel) and ENTER.
If you want to append some text instead of overwriting it completely, follow as above but using:
copy SOME_FILE.txt + con
Open up the command prompt and type:
echo SOME TEXT > SOME_FILE.txt
This method creates/overwrites SOME_FILE.txt with the text you entered before the
>. It is only suitable for entering a single line of text into a file.
As with method one, it possible to append text using
>> instead of
> in the command.