Windows command line extensions

Create an extension with a menu command

This walkthrough shows how to create an extension with a menu command that launches Notepad.

Prerequisites

Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see Install the Visual Studio SDK.

Create a menu command

  1. Create a VSIX project named FirstMenuCommand. You can find the VSIX project template in the New Project dialog by searching for «vsix».
  1. When the project opens, add a custom command item template named FirstCommand. In the Solution Explorer, right-click the project node and select Add >New Item. In the Add New Item dialog, go to Visual C# >Extensibility and select Custom Command. In the Name field at the bottom of the window, change the command file name to FirstCommand.cs.
  1. When the project opens, add a custom command item template named FirstCommand. In the Solution Explorer, right-click the project node and select Add >New Item. In the Add New Item dialog, go to Visual C# >Extensibility and select Command. In the Name field at the bottom of the window, change the command file name to FirstCommand.cs.

Build the project and start debugging.

The experimental instance of Visual Studio appears. For more information about the experimental instance, see The experimental instance.

  1. In the experimental instance, open the Tools >Extensions and Updates window. You should see the FirstMenuCommand extension here. (If you open Extensions and Updates in your working instance of Visual Studio, you won’t see FirstMenuCommand).
  1. In the experimental instance, open the Extensions >Manage Extensions window. You should see the FirstMenuCommand extension here. (If you open Manage Extensions in your working instance of Visual Studio, you won’t see FirstMenuCommand).

Now go to the Tools menu in the experimental instance. You should see Invoke FirstCommand command. At this point, the command brings up a message box that says FirstCommand Inside FirstMenuCommand.FirstCommand.MenuItemCallback(). We’ll see how to actually start Notepad from this command in the next section.

Change the menu command handler

Now let’s update the command handler to start Notepad.

Stop debugging and go back to your working instance of Visual Studio. Open the FirstCommand.cs file and add the following using statement:

Find the private FirstCommand constructor. This is where the command is hooked up to the command service and the command handler is specified. Change the name of the command handler to StartNotepad, as follows:

Remove the Execute method and add a StartNotepad method, which will just start Notepad:

Now try it out. When you start debugging the project and click Tools > Invoke FirstCommand, you should see an instance of Notepad come up.

You can use an instance of the Process class to run any executable, not just Notepad. Try it with calc.exe , for example.

Читайте также:  Windows in patient rooms

Clean up the experimental environment

If you are developing multiple extensions, or just exploring outcomes with different versions of your extension code, your experimental environment may stop working the way it should. In this case, you should run the reset script. It’s called Reset the Visual Studio Experimental Instance, and it ships as part of the Visual Studio SDK. This script removes all references to your extensions from the experimental environment, so you can start from scratch.

You can get to this script in one of two ways:

From the desktop, find Reset the Visual Studio Experimental Instance.

From the command line, run the following:

Deploy your extension

Now that you have your tool extension running the way you want, it’s time to think about sharing it with your friends and colleagues. That’s easy, as long as they have Visual Studio 2015 installed. All you have to do is send them the .vsix file you built. (Be sure to build it in Release mode.)

You can find the .vsix file for this extension in the FirstMenuCommand bin directory. Specifically, assuming you have built the Release configuration, it will be in:

To install the extension, your friend needs to close all open instances of Visual Studio, then double-click the .vsix file, which brings up the VSIX Installer. The files are copied to the %LocalAppData%\Microsoft\VisualStudio \Extensions directory.

When your friend brings up Visual Studio again, they’ll find the FirstMenuCommand extension in Tools > Extensions and Updates. They can go to Extensions and Updates to uninstall or disable the extension, too.

Next steps

This walkthrough has shown you only a small part of what you can do with a Visual Studio extension. Here’s a short list of other (reasonably easy) things you can do with Visual Studio extensions:

You can do many more things with a simple menu command:

Change the text of the menu command: Change the text of a menu command

Add different kinds of commands, menus, and toolbars: Extend menus and commands

Add tool windows and extend the built-in Visual Studio tool windows: Extend and Customize tool windows

Add IntelliSense, code suggestions, and other features to existing code editors: Extend the editor and language services

Add Options and Property pages and user settings to your extension: Extend properties and the Property window and Extend user settings and options

Other kinds of extensions require a little more work, such as creating a new type of project (Extend projects), creating a new type of editor (Create custom editors and designers), or implementing your extension in an isolated shell: Visual Studio isolated shell

Command-Line Reference

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

Use this topic to find the documentation resources and other technical information that you need to learn about the command shell, and to automate command-line tasks by using scripts or scripting tools.

To read introductory information about the command shell and command-line tools, see Feature description. To see a listing of new and deprecated command-line tools see New and deprecated functionality.

Читайте также:  Update the windows modules installer

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.

Prerequisites

The information that is contained in this overview applies to:

Windows Server 2012

WindowsВ ServerВ 2008В R2

WindowsВ ServerВ 2008

WindowsВ ServerВ 2003В R2

WindowsВ ServerВ 2003

Feature description

New and deprecated functionality

New or Deprecated?

Create a new cluster or configure an existing cluster.

Configure DFS folders and folder targets in a DFS namespace.

Creates and manages File Server Resource Manager quotas.

Create and manage file groups, file screens, file screen exceptions, and file screen templates that are used to configure general administrative options for screening files.

Enable optional features in Windows by downloading required files from WindowsВ Update or a source that Group Policy specifies.

Read, write, run, debug, and test Windows PowerShell scripts and modules in a friendly, graphic-assisted environment.

Install or remove roles, role services, and features.

Monitor an RD Session Host session.

Create and manage storage reports and storage report tasks, and configure general administrative options for File Server Resource Manager.

Command shell overview

The command shell is a software program that provides direct communication between the user and the operating system. The non-graphical, command shell user interface provides the environment in which you run character-based applications and utilities. The command shell executes programs and displays their output on the screen by using individual characters similar to the MS-DOS command interpreter, Command.com. The command shell in the Windows Server operating system uses the command interpreter, Cmd.exe. Cmd.exe loads applications, directs the flow of information between applications, and translates user input into a form that the operating system understands.

You can use the command shell to create and edit scripts to automate routine tasks. For example, you can create simple scripts in batch (.bat) files to automate the management of user accounts or nightly backups. You can also use the command-line version of Windows Script Host to 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.

Customize the Command Prompt window

You can change the properties for the Command Prompt window.

To configure the Command Prompt window

Open a Command Prompt window, click the upper-left corner of the Command Prompt window, and then click Properties. (Or to open Command Prompt Properties from the keyboard, press ALT+SPACEBAR+P.)

Click the Options tab.

In Command History, type or select 999 in Buffer Size, and then type or select 5 in Number of Buffers. By increasing the screen buffer size to 999, you enable scrolling through the Command Prompt window. By increasing the number of buffers to five, you increase the number of lines in the Command Prompt window to 5000.

In Edit Options, select the Quick Edit Mode and Insert Mode check boxes.

Click the Layout tab.

In Screen Buffer Size, type or select 2500 in Height.

To further customize your Command Prompt window settings, perform any of the following optional tasks:

Читайте также:  Обновление драйверов для windows 10 x64

In Screen Buffer Size, increase Width.

In Window Size, increase Height.

In Window Size, increase Width.

Clear the Let system position window check box, and then, in Window Position, change the values in Left and Top.

In the Apply Properties dialog box, click Save properties for future windows with same title.

To enable or disable file and directory name completion on a computer or user logon session, run Regedit.exe and set the following REG_DWORD value : HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD 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.

Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

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.

Each command-line tool topic displays the version of Windows that is supported by the command-line tool.

Working from the command line

某些 Creative Cloud 应用程序、服务和功能在中国不可用。

In Extension Manager CC, you can use the command line to perform various operations you would normally perform in the Extension Manager workspace.

Extension Manager command-line basics

You can manage extensions from the command line, using certain syntax, commands, and attributes. The command-line syntax in Extension Manager CC has changed remarkably. For command-line syntax used in Extension Manager CS6 or earlier, refer to this article.

  1. In Windows, open the command prompt by selecting Start > All Programs > Accessories > Command Prompt . In macOS, open Terminal by double-clicking its icon in the Applications/Utilities folder.
  2. On the command line, enter the executable as follows (including the double quotes):
    • Windows: «ExManCmd.exe»
    • macOS: “./ExManCmd”
  3. After the executable, enter the desired command. The following list describes the available commands:
Command on Windows Command on MAC Description Required Attributes
/help —help Display help information of the command line.
/launch —launch Launch Extension Manager from the command line
/install —install Install an extension. ZXP(file path)
/remove —remove Remove an extension. Name of the extension
/enable —enable Enable an extension. Name of the extension
/disable —disable Disable an extension. Name of the extension
/list all —list all Lists all extensions that are installed.
/list —list Display the specified product extensions. Name of the product
/update —update Update an extension Name of the extension
/list_update all —list_update all List of extensions that have fresh updates to be installed
/list_update —list_update List the specified product updated extensions Name of the product
/locale —locale Specify a locale for Extension Manager at startup lang
/list_update_extension —list_update_extension List update of an extension Name of the extension
/install_for_all —install_for_all Install extension for all user accounts in the machine. This command is allowed only with Admin privileges. ZXP(file path)
/remove_for_all —remove_for_all Remove extension for all user accounts in the machine. This command is allowed only with Admin privileges. Name of the extension
/disableSendResult —disableSendResult Do not send install or remove result to other Adobe products True/False

The following table describes the list of available attributes:

Оцените статью