共用方式為


/Command (devenv.exe)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Executes the specified command after launching the Visual Studio IDE.

Syntax

devenv /Command CommandName

Arguments

CommandName

Required. The complete name of a Visual Studio command or its alias, enclosed in double quotation marks. For more information about command and alias syntax, see Visual Studio Commands.

Remarks

After startup is complete, the IDE executes the named command.

If you use this switch, the IDE doesn't display the Start Page on startup.

If an add-in exposes a command, you can use this switch to launch the add-in from the command line. For more information, see How to: Control add-ins by using the add-in manager.

Example

The first example launches Visual Studio and automatically runs the macro Open Favorite Files.

The second example opens a web browsing tab within the IDE and navigates to the Microsoft Docs site.

The third example creates a new file called some_file.cs and opens it in a code editor.

devenv /command "Macros.MyMacros.Module1.OpenFavoriteFiles"

devenv /command "navigate https://docs.microsoft.com/"

devenv /command "nf some_file.cs"

See also