/Command (devenv.exe)

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 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 Learn 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://learn.microsoft.com/"

devenv /command "nf some_file.cs"

See also