- Windows commands
- Prerequisites
- Command shell overview
- Command-line reference A-Z
- Fix problems in Windows Search
- Check for updates
- Run the Search and Indexing troubleshooter
- Restart Windows Search or your device
- Reset Windows Search
- Windows 10, version 1809 and earlier
- Windows 10, version 1903 and later
- Help us improve Search in Windows 10
- поиск find
- Синтаксис Syntax
- Параметры Parameters
- Комментарии Remarks
- Примеры Examples
Windows commands
All supported versions of Windows (server and client) have a set of Win32 console commands built in.
This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.
Prerequisites
The information that is contained in this topic applies to:
- Windows Server 2019
- Windows Server (Semi-Annual Channel)
- Windows Server 2016
- Windows Server 2012 R2
- Windows Server 2012
- Windows Server 2008 R2
- Windows Server 2008
- Windows 10
- Windows 8.1
Command shell overview
The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all Commands that are available at the command line.
Windows has two command shells: The Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.
PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.
For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.
You can also download and install PowerShell Core, the open source version of PowerShell.
Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.
To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:
To set the reg_DWOrd value, 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.
Command-line reference A-Z
To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.
Fix problems in Windows Search
If Windows Search is unresponsive or the search results don’t appear as expected, try any of the following solutions in this article.
If you’re running Windows 10 May 2019 Update (version 1903) or later versions and Windows can detect a problem, we’ll run the Search troubleshooter automatically. This troubleshooter will reset Windows Search back to the default experience. View your troubleshooter history under Settings > Update & Security > Troubleshoot > View History. Follow the steps below if your issue is still not resolved.
Original product version: В Windows 10 — all editions
Original KB number: В 4520146
Check for updates
Windows 10 lets you choose when and how to get the latest updates to keep your device running smoothly and securely. To manage your options and see any available updates, select the Start button, and then go to Settings > Update & Security > Windows Update > Check for updates. Install any available updates, and then restart your computer if the updates require it.
For more information, see Update Windows 10.
Run the Search and Indexing troubleshooter
Your PC automatically indexes content to deliver faster search results. Learn more about Search indexing in Windows 10.
Use the Windows Search and Indexing troubleshooter to try to fix any problems that may arise. To use the troubleshooter, follow these steps:
- Select Start, then select Settings.
- In Windows Settings, select Update & Security >Troubleshoot. Under Find and fix other problems, select Search and Indexing.
- Run the troubleshooter, and select any problems that apply. Windows will try to detect and solve them.
You can also use a command prompt to open the troubleshooter. Press Windows logo key+R, enter cmd in the Open box, and then select OK. At the command prompt, run the following command:
Restart Windows Search or your device
End the SearchUI process to restart Windows Search by following these steps:
- Press Ctrl+Alt+Delete, and select Task Manager.
- In the Task Manager window, select the Details tab.
- In the Name column, right-click SearchUI.exe, and then select End task.
- When you’re prompted to end SearchUI.exe, select End process.
The Windows Search process will automatically restart the next time that you search.
If this solution doesn’t fix your problem, try restarting your device. Restarting will also install any pending updates.
You may want to bookmark this page before you restart.
Reset Windows Search
Try resetting Windows Search by using the method that’s appropriate for your version of Windows.
To determine which version of Windows your device is running, follow these steps:
Select Start > Settings > System > About.
Under Windows specifications, check which version of Windows your device is running.
Resetting Windows Search does not affect your files. However, it may temporarily affect the relevance of search results.
Windows 10, version 1809 and earlier
If the Windows 10 October 2018 Update or an earlier update is installed, reset Cortana to reset Windows Search by following these steps:
- Select Start, right-click Cortana, select More, and then select App settings.
- In the Cortana settings, select Reset.
Windows 10, version 1903 and later
If the Windows 10 May 2019 Update or a later update is installed, use Windows PowerShell to reset Windows Search by following these steps:
You must have administrator permissions to run this script.
Download the ResetWindowsSearchBox.ps1 script from the Reset Windows Search PowerShell script, and save the file to a local folder.
Right-click the file that you saved, and select Run with PowerShell.
If you’re asked the following question, select Yes.
Do you want to allow this app to make changes to your device?
The PowerShell script resets the Windows Search feature. When the word Done appears, close the PowerShell window.
If you receive the following error message:
Cannot be loaded because running scripts is disabled on this system
enter the following command on the command line of the PowerShell window, and then press Enter:
The current policy appears in the window. For example, you might see Restricted. We recommend that you note this value because you’ll have to use it later.
Enter the following command on the command line of the PowerShell window, and then press Enter:
You’ll receive a warning message that explains the security risks of an execution policy change. Press Y, and then press Enter to accept the change.
To learn more about PowerShell execution policies, see About Execution Policies.
After the policy change is completed, close the window, and then repeat steps 2-4. However, when the Done message appears this time, DON’T close the PowerShell window. Instead, press any key to continue.
Revert to your previous PowerShell execution policy setting. Enter the following command on the command line of the PowerShell window, press the Spacebar, enter the policy value that you noted in step 5, and then press Enter:
For example, if the policy that you noted in step 5 was Restricted, the command would resemble the following one:
You’ll receive a warning message that explains the security risks of an execution policy change. Press Y, and then press Enter to accept the change and revert to your previous policy setting.
Close the PowerShell window.
If your organization has disabled the ability to run scripts, contact your administrator for help.
Help us improve Search in Windows 10
If the previous suggestions don’t fix the problem, let us know by sending feedback in the Feedback Hub. Provide details, such as a description of the problem, screenshots, log files, and any other information that might be helpful. In the Feedback Hub, select the appropriate category and subcategory. In this case, submit your feedback in the Cortana and Search category.
поиск find
Выполняет поиск строки текста в файле или файлах и отображает строки текста, содержащие указанную строку. Searches for a string of text in a file or files, and displays lines of text that contain the specified string.
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
/v /v | Отображает все строки, не содержащие указанный объект . Displays all lines that don’t contain the specified . |
/C /c | Подсчитывает количество строк, содержащих указанный объект , и отображает итоговое значение. Counts the lines that contain the specified and displays the total. |
/n /n | Предшествует каждой строке с номером строки файла. Precedes each line with the file’s line number. |
/i /i | Указывает, что при поиске регистр не учитывается. Specifies that the search is not case-sensitive. |
[«/OFF» [строка]] [/off[line]] | Не пропускает файлы с установленным атрибутом «вне сети». Doesn’t skip files that have the offline attribute set. |
Обязательный элемент. Required. Задает группу символов (заключенных в кавычки), которые требуется найти. Specifies the group of characters (enclosed in quotation marks) that you want to search for. | |
[ :][ |
]
Комментарии Remarks
Если вы не используете /i, эта команда ищет именно то, что указано для String. If you don’t use /i, this command searches for exactly what you specify for string. Например, эта команда обрабатывает символы и по a — A разному. For example, this command treats the characters a and A differently. Однако при использовании параметра /i Поиск выполняется без учета регистра, а в a A качестве того же символа обрабатывается и. If you use /i, however, the search becomes non-case-sensitive, and it treats a and A as the same character.
Если строка, которую нужно найти, содержит кавычки, необходимо использовать двойные кавычки для каждой кавычки, содержащейся в строке (например, «» Эта строка содержит кавычки «»). If the string you want to search for contains quotation marks, you must use double quotation marks for each quotation mark contained within the string (for example, «»This string contains quotation marks»»).
Если опустить имя файла, эта команда выступает в качестве фильтра, принимая входные данные из стандартного источника входных данных (обычно это клавиатура, канал (|) или перенаправленный файл), а затем отображает все строки, содержащие строку. If you omit a file name, this command acts as a filter, taking input from the standard input source (usually the keyboard, a pipe (|), or a redirected file) and then displays any lines that contain string.
Параметры и параметры командной строки для команды Find можно вводить в любом порядке. You can type parameters and command-line options for the find command in any order.
Нельзя использовать подстановочные знаки (* и ?) в именах файлов или расширениях, указанных при использовании этой команды. You can’t use wildcards (* and ?) in file names or extensions that you specify while using this command. Для поиска строки в наборе файлов, указанных с помощью подстановочных знаков, эту команду можно использовать в команде for . To search for a string in a set of files that you specify with wildcards, you can use this command within a for command.
При использовании /c и /v в одной командной строке эта команда отображает количество строк, которые не содержат указанную строку. If you use /c and /v in the same command line, this command displays a count of the lines that don’t contain the specified string. При указании параметра /c и /n в той же командной строке команда Find игнорирует параметр /n. If you specify /c and /n in the same command line, find ignores /n.
Эта команда не распознает возвраты каретки. This command doesn’t recognize carriage returns. При использовании этой команды для поиска текста в файле, который содержит символы возврата каретки, необходимо ограничить строку поиска текстом, который может быть найден между возвратами каретки (то есть строкой, которая не может быть прервана символом возврата каретки). When you use this command to search for text in a file that includes carriage returns, you must limit the search string to text that can be found between carriage returns (that is, a string that is not likely to be interrupted by a carriage return). Например, эта команда не сообщает о совпадении для строкового налогового файла, если между словами налога и файла происходит возврат каретки. For example, this command doesn’t report a match for the string tax file if a carriage return occurs between the words tax and file.
Примеры Examples
Чтобы отобразить все строки из Pencil.AD , которые содержат строку резкость карандаша, введите: To display all lines from pencil.ad that contain the string pencil sharpener, type:
Чтобы найти текст, «специалисты, обозначенные в документе только для обсуждения. To find the text, «The scientists labeled their paper for discussion only. Это не окончательный отчет «. It is not a final report.» в файле report.doc введите: in the report.doc file, type:
Для поиска набора файлов можно использовать команду Find в команде for . To search for a set of files, you can use the find command within the for command. Чтобы найти в текущем каталоге файлы с расширением bat, которые содержат строку строки, введите следующую команду: To search the current directory for files that have the extension .bat and that contain the string PROMPT, type:
Чтобы найти и отобразить имена файлов на диске C, которые содержат строковый ЦП, выполните поиск на жестком диске с помощью вертикальной черты (|), чтобы направить выходные данные команды dir в команду Find следующим образом: To search your hard disk to find and display the file names on drive C that contain the string CPU, use the pipe (|) to direct the output of the dir command to the find command as follows:
Так как поиск при поиске выполняется с учетом регистра, а dir создает прописные буквы, необходимо либо ввести строковый процессор в верхнем регистре, либо использовать параметр командной строки /i с командой Find. Because find searches are case-sensitive and dir produces uppercase output, you must either type the string CPU in uppercase letters or use the /i command-line option with find.