Windows find command line options

Command-Line Options

The executable program that interprets packages and installs products is Msiexec.exe. Note that Msiexec also sets an error level on return that corresponds to system error codes. Command-line options are case-insensitive.

The command-line options in the following table are available with Windows Installer 3.0 and earlier versions. The Standard Installer Command-Line Options are also available beginning with Windows Installer 3.0.

Option Parameters Meaning
/I Package|ProductCode Installs or configures a product.
/f [p|o|e|d|c|a|u|m|s|v] Package|ProductCode Repairs a product. This option ignores any property values entered on the command line. The default argument list for this option is ‘omus.’ This option shares the same argument list as the REINSTALLMODE property.
p — Reinstalls only if file is missing.
o — Reinstalls if file is missing or an older version is installed.
e — Reinstalls if file is missing or an equal or older version is installed.
d — Reinstalls if file is missing or a different version is installed.
c — Reinstalls if file is missing or the stored checksum does not match the calculated value. Only repairs files that have msidbFileAttributesChecksum in the Attributes column of the File table.
a — Forces all files to be reinstalled.
u — Rewrites all required user-specific registry entries.
m — Rewrites all required computer-specific registry entries.
s — Overwrites all existing shortcuts.
v — Runs from source and re-caches the local package. Do not use the v reinstall option for the first installation of an application or feature.
/a Package Administrative installation option. Installs a product on the network.
/x Package|ProductCode Uninstalls a product.
/j [u|m]Packageor
[u|m]Package/tTransform List
or
[u|m]Package/gLanguageID
Advertises a product. This option ignores any property values entered on the command line.
u — Advertises to the current user.
m — Advertises to all users of machine.
g — Language identifier.
t — Applies transform to advertised package.
/L [i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] Logfile Writes logging information into a logfile at the specified existing path. The path to the logfile location must already exist. The installer does not create the directory structure for the logfile. Flags indicate which information to log. If no flags are specified, the default is ‘iwearmo.’
i — Status messages.
w — Nonfatal warnings.
e — All error messages.
a — Start up of actions.
r — Action-specific records.
u — User requests.
c — Initial UI parameters.
m — Out-of-memory or fatal exit information.
o — Out-of-disk-space messages.
p — Terminal properties.
v — Verbose output.
x — Extra debugging information. Windows Installer 2.0: Not supported. The x option is available with Windows Installer version 3.0.3790.2180 and later.

+ — Append to existing file.
! — Flush each line to the log.
«*» — Wildcard, log all information except for the v and x options. To include the v and x options, specify «/l*vx».

[!Note]
For more information about all the methods that are available for setting the logging mode, see Normal Logging in the Windows Installer Logging section

[!Note]
The length of filename must be no more than eight characters.

Generates an SMS status .mif file. Must be used with either the install (-i), remove (-x), administrative installation (-a), or reinstall (-f) options. The ISMIF32.DLL is installed as part of SMS and must be on the path.
The fields of the status mif file are filled with the following information:
Manufacturer — Author
Product — Revision Number
Version — Subject
Locale — Template
Serial Number — not set
Installation — set by ISMIF32.DLL to «DateTime»
InstallStatus — «Success» or «Failed»
Description — Error messages in the following order: 1) Error messages generated by installer. 2) Resource from Msi.dll if installation could not commence or user exit. 3) System error message file. 4) Formatted message: «Installer error %i», where %i is error returned from Msi.dll.
/p PatchPackage[;patchPackage2 ] Applies a patch. To apply a patch to an installed administrative image you must combine the following options:
/p

Advertises a new instance of the product. Must be used in conjunction with /t. Available starting with the Windows Installer version that is shipped with Windows Server 2003 and Windows XP with Service Pack 1 (SP1).
/n ProductCode Specifies a particular instance of the product. Used to identify an instance installed using the multiple instance support through a product code changing transforms. Available starting with the Windows Installer version shipped with Windows Server 2003 and Windows XP with SP1.

The options /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, /p, /y and /z should not be used together. The one exception to this rule is that patching an administrative installation requires using both /p and /a. The options /t, /c and /g should only be used with /j. The options /l and /q can be used with /i, /x, /f[p|o|e|d|c|a|u|m|s|v], /j[u|m], /a, and /p. The option /n can be used with /i, /f, /x and /p.

To install a product from A:\Example.msi, install the product as follows:

msiexec /i A:\Example.msi

Only public properties can be modified using the command line. All property names on the command line are interpreted as uppercase but the value retains case sensitivity. If you enter MyProperty at a command line, the installer overrides the value of MYPROPERTY and not the value of MyProperty in the Property table. For more information, see About Properties.

To install a product with PROPERTY set to VALUE, use the following syntax on the command line. You can put the property anywhere except between an option and its argument.

msiexec /i A:\Example.msi PROPERTY=VALUE

msiexec /i PROPERTY=VALUE A:\Example.msi

Property values that are literal strings must be enclosed in quotation marks. Include any white spaces in the string between the marks.

msiexec /i A:\Example.msi PROPERTY=»Embedded White Space»

To clear a public property by using the command line, set its value to an empty string.

msiexec /i A:\Example.msi PROPERTY=»»

For sections of text set apart by literal quotation marks, enclose the section with a second pair of quotation marks.

msiexec /i A:\Example.msi PROPERTY=»Embedded «»Quotes»» White Space»

The following example shows a complicated command line.

msiexec /i testdb.msi INSTALLLEVEL=3 /l* msi.log COMPANYNAME=»Acme «»Widgets»» and «»Gizmos.»»»

The following example shows advertisement options. Note that switches are not case-sensitive.

msiexec /JM msisample.msi /T transform.mst /LIME logfile.txt

The following example shows you how to install a new instance of a product to be advertised. This product is authored to support multiple instance transforms.

msiexec /JM msisample.msi /T :instance1.mst;customization.mst /c /LIME logfile.txt

The following example shows how to patch an instance of a product that is installed using multiple instance transforms.

msiexec /p msipatch.msp;msipatch2.msp /n <00000001-0002-0000-0000-624474736554>/qb

When you apply patches to a specific product, the /i and /p options cannot be specified together in a command line. In this case, you can apply patches to a product as follows.

msiexec /i A:\Example.msi PATCH=msipatch.msp;msipatch2.msp /qb

The PATCH property cannot be set in a command line, when /p option is used. If the PATCH property is set when the /p option is used, the value of PATCH property is ignored and overwritten.

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.

поиск 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.
[ :][

] Указывает расположение и имя файла, в котором выполняется поиск указанной строки. Specifies the location and name of the file in which to search for the specified string. /? /? Отображение справки в командной строке. Displays help at the command prompt.

Комментарии 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.

Читайте также:  Violets on the windows
Оцените статью