Меню Рубрики

Read file from cmd windows

20 Useful Windows Commands for managing files

Most people do not normally use command prompt commands in windows as they find it easy to use it as a graphic user interface. Using commands is not limited to linux. You can use beautiful commands for doing zillions of things and that too at a pretty fast rate. The capability of commands on command prompt is immense. Here in this article , i have listed some useful Commands of command prompt in windows Os.

Create New file

Step 1: – First of all go to the respective folder, in which you want to create the file.

Step 2: – Now, Press shift and do a right click anywhere.

Step 3: – Now, Click on Open command prompt window here.

Note: – This is the quickest method to browse to any directory and open command prompt right from there.

Step 4: – Now, write the following command given below to create the file here.

Note that 3000 is file size in KB. You are also telling windows to create the file with that much required size. You can create any file type. Just give the required extension , name and file size.

Find files older than n days inside a folder

To find files older than 1 day, use command given below.

Find files modified in last n days

Find files larger than a specific size

You can run forfiles command in this case.

For example if you have to find files larger than 1 gb = 1073741824 bytes, the command would be as given below.

To find files larger than 1 MB use the given command.

Rename all File extensions inside a folder at Once

Now, go to the folder where all the files are kept. Now, do a shift + right click to open command prompt there.

Now, just write the command given below to rename png to jpeg.

Note: – Just use any extensions in place of jpg and png above by replacing jpg and png with your required extensions.

The above command does not run recursively. It means , this command will not affect the files kept in subfolders.

To use it recursively use the given below command.

In above command we are changing all files with .jpeg to .png .

Delete System Files in Windows

Who says you can’t delete system files. To delete system files:-

Get File Creation Time and Date

Use the command given below to get the date and time when the file is created.

Find out a string inside a file

The command given below will fetch all lines and print them on screen having the word .

For example if we have to find all lines containing windows in file.txt, then we will use command given below.

Note that, the above command is case sensitive. To do a case insensitive search add /I after the string.

You can also search for lines having any of the given strings.

Take ownership of a file

Get the list of all hidden files inside a folder

To get the list of all hidden files and folders inside a directory use the given command.

To get the full list of all hidden files / folders inside all sub-folders, use below given command.

Compress a File using command line

Hide a file using Command line

The file hidden by this method cannot be seen even with windows normal show hidden files and folder option method.

To unhide the file again, use: –

Set Read Only attribute to a file

To remove read only attribute from the file again.

Delete a file in Windows Using CMD

For deleting the file Just go to the respective folder. do a shift + Right click and open command prompt window there.

Now use the command given below.

To delete all the files in current folder

To delete all the files with ‘.jpeg’ extension

To Delete all files having the ‘abc’ somewhere in file name

Rename a File Command

Read File Command

Now, to read the contents of the file, just open command prompt at the location where the file is kept.

Now, just write the command given below.

Read last 10 or 20 Lines from a file

This Command will fetch last n lines from the file and display it on the command prompt window. You can read any number of lines from the file. Just replace 10 with any number.

Move File / Folder to another Location

In this move command is followed by filename and the destination in which you want to move the file.

Move all files of a common extension to a new folder.

Move all files starting with letter C.

Similarly you can move folders to a new location. Just use the folder name.

Copy files from one destination to another

To copy all files inside a folder to another location

To copy all files and also sub-folders inside the folder as well.

Saurav is associated with IT industry and computers for more than a decade and is writing on The Geek Page on topics revolving on windows 10 and softwares.

Источник

cmd cmd

Запускает новый экземпляр интерпретатора команд Cmd.exe. Starts a new instance of the command interpreter, Cmd.exe. Если используется без параметров, Команда cmd отображает версию и сведения об авторских правах операционной системы. If used without parameters, cmd displays the version and copyright information of the operating system.

Синтаксис Syntax

Параметры Parameters

Параметр Parameter Описание Description
/C /c Выполняет команду, указанную в строке , а затем останавливается. Carries out the command specified by string and then stops.
/k /k Выполняет команду, указанную в строке , и продолжит. Carries out the command specified by string and continues.
/s /s Изменяет обработку строки после /c или /k. Modifies the treatment of string after /c or /k.
/q /q Отключает вывод. Turns the echo off.
/d /d Отключает выполнение команд AutoRun. Disables execution of AutoRun commands.
/a /a Форматирует выходные данные внутренней команды в канал или файл как Американский национальный институт стандартов (ANSI) (ANSI). Formats internal command output to a pipe or a file as American National Standards Institute (ANSI).
/U /u Форматирует выходные данные внутренней команды в канал или файл в Юникоде. Formats internal command output to a pipe or a file as Unicode.
/t: < /t:

> > Задает цвета фона (b) и переднего плана (f). Sets the background (b) and foreground (f) colors.
/e: вкл. /e:on Включает расширения команд. Enables command extensions.
/e: выкл. /e:off Отключает расширения команд. Disables commands extensions.
/f: вкл. /f:on Включает завершение имени файла и каталога. Enables file and directory name completion.
/f: выкл. /f:off Отключает завершение имен файлов и каталогов. Disables file and directory name completion.
/v: вкл. /v:on Включает отложенное расширение переменных среды. Enables delayed environment variable expansion.
/v: выкл. /v:off Отключает отложенное расширение переменных среды. Disables delayed environment variable expansion.
Указывает команду, которую требуется выполнить. Specifies the command you want to carry out.
/? /? Отображение справки в командной строке. Displays help at the command prompt.

В следующей таблице перечислены допустимые шестнадцатеричные цифры, которые можно использовать в качестве значений для параметров и . The following table lists valid hexadecimal digits that you can use as the values for and :

Значение Value Color Color
0 0 Черный Black
1 1 Синий Blue
2 2 Зеленый Green
3 3 Aqua Aqua
4 4 Красный Red
5 5 Сиреневый Purple
6 6 Желтый Yellow
7 7 White White
8 8 Серый Gray
9 9 Светло-синий Light blue
а a светло-зеленый Light green
b b Светло-голубой Light aqua
c c Светло-красный Light red
d d Светло-фиолетовый Light purple
й e Светло-желтый Light yellow
f f Светлое белое Bright white

Примечания Remarks

Чтобы использовать несколько команд для , разделите их по разделителю команд && и заключите их в кавычки. To use multiple commands for , separate them by the command separator && and enclose them in quotation marks. Пример: For example:

При указании параметра /c или /k, Команда cmd , оставшаяся часть строкии кавычки сохраняются только при соблюдении всех следующих условий. If you specify /c or /k, cmd processes, the remainder of string, and the quotation marks are preserved only if all of the following conditions are met:

Кроме того, не используется параметр /s. You don’t also use /s.

Вы используете ровно один набор кавычек. You use exactly one set of quotation marks.

В кавычки не используются специальные символы (например, & () @ ^ |). You don’t use any special characters within the quotation marks (for example: & ( ) @ ^ | ).

В кавычках используется один или несколько пробельных символов. You use one or more white-space characters within the quotation marks.

Строка в кавычках — это имя исполняемого файла. The string within quotation marks is the name of an executable file.

Если предыдущие условия не выполнены, строка обрабатывается путем проверки первого символа, чтобы проверить, является ли он открывающей кавычкой. If the previous conditions aren’t met, string is processed by examining the first character to verify whether it is an opening quotation mark. Если первый символ является открывающей кавычкой, он удаляется вместе с закрывающей кавычкой. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Любой текст, следующий за закрывающими кавычками, сохраняется. Any text following the closing quotation marks is preserved.

Если не указать параметр /d в строке, Cmd.exe ищет следующие подразделы реестра: If you don’t specify /d in string, Cmd.exe looks for the following registry subkeys:

HKEY_LOCAL_MACHINE \Софтваре\микрософт\комманд Процессор\ауторун\ REG_SZ HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ

HKEY_CURRENT_USER \Софтваре\микрософт\комманд Процессор\ауторун\ REG_EXPAND_SZ HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_SZ

Если имеется один или оба подраздела реестра, они выполняются перед всеми остальными переменными. If one or both registry subkeys are present, they’re executed before all other variables.

Неправильное изменение реестра может серьезно повредить систему. Incorrectly editing the registry may severely damage your system. Перед внесением изменений следует сделать резервную копию всех ценных данных на компьютере. Before making changes to the registry, you should back up any valued data on the computer.

Вы можете отключить расширения команд для определенного процесса, используя /e: Off. You can disable command extensions for a particular process by using /e:off. Вы можете включить или отключить расширения для всех параметров командной строки cmd на компьютере или сеансе пользователя, задав следующие значения REG_DWORD . You can enable or disable extensions for all cmd command-line options on a computer or user session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE \Софтваре\микрософт\комманд Процессор\енабликстенсионс\ REG_DWORD HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

HKEY_CURRENT_USER \Софтваре\микрософт\комманд Процессор\енабликстенсионс\ REG_DWORD HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD

Присвойте параметру REG_DWORD значение 0 × 1 (включено) или 0 × 0 (отключено) в реестре с помощью Regedit.exe. Set the REG_DWORD value to either 0×1 (enabled) or 0×0 (disabled) in the registry by using Regedit.exe. Заданные пользователем параметры имеют приоритет над параметрами компьютера, а параметры командной строки имеют приоритет над параметрами реестра. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Неправильное изменение реестра может серьезно повредить систему. Incorrectly editing the registry may severely damage your system. Перед внесением изменений следует сделать резервную копию всех ценных данных на компьютере. Before making changes to the registry, you should back up any valued data on the computer.

При включении расширений команд затрагиваются следующие команды: When you enable command extensions, the following commands are affected:

assoc assoc

call call

chdir (CD) chdir (cd)

color color

Del (стирание) del (erase)

endlocal endlocal

for for

ftype ftype

goto goto

if if

mkdir (MD) mkdir (md)

popd popd

prompt prompt

pushd pushd

set set

setlocal setlocal

shift shift

Start (также включает изменения во внешние командные процессы) start (also includes changes to external command processes)

При включении отложенного расширения переменных среды можно использовать символ восклицательного знака для замены значения переменной среды во время выполнения. If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.

По умолчанию завершение имени файла и каталога не включено. File and directory name completion is not enabled by default. Можно включить или отключить завершение имени файла для определенного процесса команды cmd с параметром /f:<On | Off>. You can enable or disable file name completion for a particular process of the cmd command with /f:<on | off>. Можно включить или отключить завершение имени файла и каталога для всех процессов команды cmd на компьютере или сеанса входа пользователя, задав следующие значения REG_DWORD . You can enable or disable file and directory name completion for all processes of the cmd command on a computer or for a user logon session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE \Софтваре\микрософт\комманд Процессор\комплетиончар\ REG_DWORD HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_LOCAL_MACHINE \Софтваре\микрософт\комманд Процессор\паскомплетиончар\ REG_DWORD HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

HKEY_CURRENT_USER \Софтваре\микрософт\комманд Процессор\комплетиончар\ REG_DWORD HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD

HKEY_CURRENT_USER \Софтваре\микрософт\комманд Процессор\паскомплетиончар\ REG_DWORD HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD

Чтобы задать значение REG_DWORD , выполните Regedit.exe и используйте шестнадцатеричное значение управляющего символа для конкретной функции (например, 0 × 9 — TAB, а 0 × 08 — это BACKSPACE). To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0×9 is TAB and 0×08 is BACKSPACE). Заданные пользователем параметры имеют приоритет над параметрами компьютера, а параметры командной строки имеют приоритет над параметрами реестра. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Неправильное изменение реестра может серьезно повредить систему. Incorrectly editing the registry may severely damage your system. Перед внесением изменений следует сделать резервную копию всех ценных данных на компьютере. Before making changes to the registry, you should back up any valued data on the computer.

Если включить завершение имен файлов и каталогов с помощью /f: on, используйте сочетание клавиш CTRL + D для завершения имен каталогов и Ctrl + f для завершения имени файла. If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion. Чтобы отключить определенный символ завершения в реестре, используйте значение пробела [0 × 20], так как оно не является допустимым управляющим символом. To disable a particular completion character in the registry, use the value for white space [0×20] because it is not a valid control character.

При нажатии клавиш CTRL + D или CTRL + Fобрабатывается завершение имени файла и каталога. Pressing CTRL+D or CTRL+F, processes the file and directory name completion. Эти функции сочетания клавиш добавляют символ-шаблон к строке (если он отсутствует), формирует список совпадающих путей, а затем отображает первый соответствующий путь. These key combination functions append a wildcard character to string (if one is not present), builds a list of paths that match, and then displays the first matching path.

Если ни один из путей не соответствует, функция завершения имени файла и каталога выдает звуковой сигнал и не изменяет отображение. If none of the paths match, the file and directory name completion function beeps and does not change the display. Для перемещения по списку совпадающих путей нажмите клавиши CTRL + D или CTRL + F несколько раз. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. Для перемещения по списку назад нажмите клавишу SHIFT и CTRL + D или CTRL + F одновременно. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. Чтобы отменить сохраненный список совпадающих путей и создать новый список, измените строку и нажмите клавиши CTRL + D или CTRL + F. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. Если переключиться между сочетаниями Ctrl + D и CTRL + F, сохраненный список соответствующих путей отбрасывается и создается новый список. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. Единственное различие между сочетаниями клавиш Ctrl + d и Ctrl + f заключается в том, что сочетание клавиш Ctrl + d соответствует именам каталогов, а сочетание клавиш CTRL + F соответствует именам файлов и каталогов. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. Если вы используете автозаполнение имен файлов и каталогов во всех встроенных командах каталога (т. е. CD, MDили RD), предполагается завершение каталога. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.

Имя файла и каталога правильно обрабатывает имена файлов, которые содержат пробелы или специальные символы, если они заключены в кавычки для соответствующего пути. File and directory name completion correctly processes file names that contain white space or special characters if you place quotation marks around the matching path.

Необходимо использовать кавычки для следующих специальных символов: & [] <> ^ =;! You must use quotation marks around the following special characters: & [ ] < >^ = ; ! ‘ +, ‘

Если предоставленные сведения содержат пробелы, заключите текст в кавычки (например, «имя компьютера»). If the information that you supply contains spaces, you must use quotation marks around the text (for example, «Computer Name»).

Если обработка имени файла и каталога выполняется из строки, любая часть пути справа от курсора отбрасывается (в точке, где обработано завершение). If you process file and directory name completion from within string, any part of the path to the right of the cursor is discarded (at the point in string where the completion was processed).

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Read ext4 windows 10
  • React native установка на windows
  • React native windows phone
  • React native install windows
  • Re image your computer windows 7 ключом