共用方式為


Web Deploy Command Line Syntax

Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP

The principal elements of the Msdeploy.exe command line are a verb (also called an operation), a source, an optional destination, and optional operation settings. The verb and source are required. A destination is required by some verbs, but not others. Optional operation settings modify how the command runs.

The following shows the Msdeploy.exe command-line syntax. Arguments are shown in italics enclosed in angle brackets (for example, <verbName>). Optional arguments are enclosed by square brackets (for example, [-dest]).

msdeploy.exe -verb:<verbName>
             -source:<provider>[=<pathToProviderObject>
                      [,<providerSetting>=<providerSettingValue>]]
             [-dest:<provider>[=<pathToProviderObject>
                      [,<providerSetting>=<providerSettingValue>]]
             ]
             [-<MSDeployOperationSetting> ...]

Arguments

   

-verb:<verbName>

Specifies a Web Deploy verb. A verb determines the action to be taken on a source or destination object. <verbName> must be one of the following: delete, dump, getDependencies, getSystemInfo, or sync. The sync verb requires both the -source and -dest arguments. The delete verb requires only the -dest argument. For more information about verbs, see Web Deploy Operations.

   

-source:<provider>

Specifies the source of the data for the verb argument. source is a required argument for the sync and dump operations, but not delete. The <provider> is a Web Deploy code feature that handles a specific kind of Web server-related source or destination object. The following settings are used with <provider>. For more information about providers, see Web Deploy Providers.

Setting Description

[=<pathToProviderObject>

Specifies a path of the provider object. Some providers require a path and some do not. If required, the kind of path depends on the provider.

[,<providerSetting>=<providerSettingValue>]]

Provider settings optionally specify additional information about how the source or destination provider will be accessed. <provider> or <provider>=<pathToProviderObject> may be followed by one or more settings. Provider settings are separated from the provider and from each other by a comma and no spaces.

For possible values for <providerSetting> and <providerSettingValue>, see Web Deploy Provider Settings. One frequently used provider setting is computerName, which specifies the name of a source or destination computer.

   

-dest: <provider>

Specifies the destination of a synchronization operation. The destination argument is required only if the sync or delete verb is specified. The provider, provider paths, and provider settings that can be used with -dest are the same as those described for -source.

   

[-<MSDeployOperationSetting> ... ]

Operation settings affect the execution of an entire Web Deploy operation. More than one operation setting can be used in a single command. Each operation setting is preceded by a space and a hyphen. For more information about operation settings, see Web Deploy Operation Settings.

   

/?, -?

Displays command-line help and version information. Typing msdeploy, msdeploy /?, or msdeploy -? after the command prompt shows summary help on Web Deploy syntax, operation settings, verbs, providers, and provider settings. For more detailed help, add the -help argument to any partial command line (for example, for help on the apphostconfig provider, type msdeploy -help -source:apphostconfig).

Tip

To display just the version of the Web Deployment Tool that you are using, type msdeploy | find "Version".

Using Web Deploy with Windows PowerShell

With a minor modification to its usual syntax, Web Deploy commands can be run from a Windows PowerShell prompt. To do this, change the colon character (:) after the verb, source, and dest arguments of the Web Deploy command to an equal sign (=). In the following example, compare the Web Deploy command with its PowerShell version.

Web Deploy command: msdeploy -verb:sync -source:metakey=/lm/w3svc/1 -dest:metakey=/lm/w3svc/2 -verbose

PowerShell command: .\msdeploy.exe -verb=sync -source=metakey=/lm/w3svc/1 -dest=metakey=/lm/w3svc/2 -verbose

See Also

Web Deploy Operations

Web Deploy Operation Settings

Web Deploy Providers

Web Deploy Provider Settings