Windows edit command line

EDIT – запустить текстовый редактор MS DOS / Windows XP.

Текстовый редактор edit.com входил в стандартный состав программ для MS DOS и Windows, до Windows XP включительно. Применялся как простое средство редактирования с функциями поиска и замены текста, возможностью использования буфера обмена, удалением и сдвигом выделенного фрагмента, перемещением внутри документа с использованием комбинаций клавиш и т.п.

Формат командной строки:

EDIT [/B] [/H] [/R] [/S] [/ ] [/?] [файлы]

/B — Монохромный экран.

/H — Максимально возможное число строк.

/R — Загрузка файлов в режиме доступа только для чтения.

/S — Использование только коротких имен файлов.

/ — Загрузка двоичных файлов с разбиением на строки по байт.

/? — Вывод справочной информации.

[файлы] — Имя либо имена загружаемых файлов. Допускается использование подстановочных знаков и нескольких образцов одновременно.

edit /? — отобразить подсказку по использованию.

edit myfile.txt — открыть для редактирования файл myfile.txt текущего каталога.

edit /r myfile.txt — открыть для просмотра файл myfile.txt текущего каталога.

edit –r %TEMP%\*.log — открыть для просмотра файлы с расширением .log в каталоге временных файлов, заданном значением переменной TEMP . Файлы открываются последовательно, с использованием меню редактора, вызываемого клавишей ALT . После закрытия (меню Файл — Закрыть ), будет открыт следующий файл, соответствующий шаблону *.log пока не будет исчерпан весь список. Для прекращения последовательной обработки файлов и закрытия редактора используется ALT — Файл — Выход

edit /40 –r C:\Windows \System32\edit.com — открыть для просмотра исполняемый файл самого редактора edit.com в режиме отображения строками по 40 символов в строке.

1.txt — открыть файл bignamefile.txt с использованием его короткого имени преобразованного в соответствии со стандартом 8.3 (8Dot3Name)

Редактор edit.com — это 16-разрядное приложение, которое можно использовать и в более поздних ОС Windows, до 32-разрядной Windows 8 включительно, если разрешить выполнение 16-разрядных приложений:

Включить или выключить поддержку 16-разрядных приложений можно групповыми политиками или изменением параметра реестра DisallowedPolicyDefault:

reg add hklm\system\CurrentControlSet\Control\WOW /v «DisallowedPolicyDefault» /t REG_DWORD /d 0 /f

Если параметр DisallowedPolicyDefault устанавливается в 0, то поддержка 16-разрядных приложений включена. Для отключения поддержки, параметр нужно установить в 1:

reg add hklm\system\CurrentControlSet\Control\WOW /v «DisallowedPolicyDefault» /t REG_DWORD /d 1 /f

Читайте также:  Как восстановить систему при включении компьютера windows

В 64-разрядных ОС, в том числе и Windows XP x64, поддержки 16-разрядных приложений нет.

MS-DOS and Windows command line edit command

The MS-DOS text editor, edit, allows you to view, create, or modify any text file on your computer. While running edit, a screen similar to the picture below is shown.

Availability

Edit is an external command available for the following Microsoft operating systems.

The edit command is a legacy 16-bit program, which is incompatible with 64-bit operating systems. Therefore, 64-bit versions of Windows do not come installed with, and cannot run, the edit command. On 64-bit Windows systems, use Notepad to edit files instead. See: Why is the edit command missing in Windows?

Edit syntax

/B Forces monochrome mode.
/H Displays the maximum number of lines possible for your hardware.
/R Load file(s) in read-only mode.
/S Forces the use of short file names.
/ Load binary file(s), wrapping lines to characters wide.
/? Display a summary of command line options.
[FileName. ] Specifies initial files(s) to load. Wildcards and multiple file specs can be given.

Edit examples

Open the file c:\autoexec.bat to be edited, if it exists. If the file does not exist, a blank blue screen is shown.

If you are using new versions of Windows running under a 64-bit processor, the edit command no longer works. See: How to open, view, and edit the contents of a file on a computer.

Using «copy con»

If you are running an MS-DOS version 4.x or lower or you cannot find edit.com on your hard drive, you can also use the following command to create a file.

Once you have entered the command above, a file with the name specified is created.

Once you have typed all the lines you want to be in the file, press and hold Ctrl + Z . Once you see «^Z» on the screen, press Enter and one file should be copied.

Команда Edit

Позволяет начать работу редактора подсистемы MS-DOS. Его основной задачей считается создание и внесение изменений в текстовые документы, обладающие форматом ASCII. Если была задействована указанная команда, происходит запуск редактора MS-DOS.

Синтаксис

edit [[диск_компьютера:][путь] название_файла] [/b] [/g] [/h] [/nohi]

Расшифровка значений

[диск_компьютера:][путь] название_файла

Указывает, где именно находится интересующий документ. В том случае, если по указанному адресу ничего нет, будет создан текстовый файл. Когда документ уже имеется, то происходит выдача его содержимого.

Читайте также:  Windows forms chart zoom

/b

В некоторых ситуация, на ч/б мониторе происходит неверное отображение информации. Для исправления подобной проблемы используется данный параметр. Его задачей является задание черно-белого режима для редактора подсистемы MS-DOS.

/g

Если применяется монитор типа CGA, то подобный параметр устанавливается самый быстрый режим функционирования.

/h

Позволяет установить самое большое доступное число строк для конкретного монитора.

/nohi

Редактор MS-DOS осуществляет функционирование в режиме 8ми цветов. В обычном состоянии, ОС Windows XP применяет 16-ти цветовую палитру.

Особенности команды

Следует учитывать тот факт, что ряд мониторов не способен поддерживать функцию отображения клавиш быстрого вызова. Рекомендуется применение /b (если монитор относится к типу CGA) или /nohi (когда отсутствует возможность выделять полужирным).

Binary file edit in Win CMD

How to split or edit binary file in Win CMD?
I’m on Win 10 x64, and there’s no DEBUG utility

eg. to replace all 0a with 0d0a or change a byte value at some byte offset?

2 Answers 2

Yes, debug is an «old» DOS command (maybe it was present till WindowsXP or so). I do not know any default way to manipulate binary files under Windows 10.
You need to find a third-party-tool which can provide the desired functionality. Right now I have no hint for you, where to find one or which one would work best. Please try a web search on your own.

However, you could check out some visual tools, if there is no urgent need to use a batch file. Like HxD for example. A free, versatile Hex-Editor for Windows. It should come with a find/replace functionality that might to the job for you.

fc /b performs a similar function to certutil -encodehex -f 12 .

The resulting hex file can then be manipulated (edited/processed) by common batch commands before written back to disk in binary, just like HxD .

Each character in the resultant (or intermediate, rather) file is a nibble, and may be processed as pairs to reflect the full byte of the current binary file encoding.

To replace characters, conduct a string search/replace.
For offsets, search for & replace with for loop.
To split binary files, parse upto required character/offset, write part file, then parse next length of characters. Continue until whole file has been parsed & split.

How do I edit text files in the Windows command prompt?

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.

Читайте также:  Восстановление windows с помощью биос

10 Answers 10

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.

The simplest solution on all versions of Windows is:

And, no extra software required.

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’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.

If you have git installed for windows then most likely nano and vim are both available at

To run from a command prompt (cmd.exe)

To run in powershell

They both work great even over ssh.

Believe it or not, EDLIN.EXE is still around 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.

Оцените статью