web-dev-qa-db-fra.com

Comment puis-je obtenir simplement le nom du site à partir de la commande "AppCMD.EXE Liste Site"?

Si j'exécute la commande suivante sur mon serveur:

%windir%\system32\inetsrv\AppCmd.exe list site

Je reçois cette sortie:

SITE "MyCompany.MyProject.WebRole_IN_0_Web" (id:1273337555,bindings:https/555.555.555.555:443:,state:Started)

Comment puis-je obtenir le nom du site:

MyCompany.MyProject.WebRole_IN_0_Web

Est-ce qu'une sorte de chaîne méchante analyse ma seule option? Le serveur est une instance Windows Azure.

5
Tom Robinson

J'ai compris:

appcmd list site /text:name

Vous donne ceci:

MyCompany.MyProject.WebRole_IN_0_Web

L'aide décrit comment cela fonctionne:

/text<:value>    Generate output in text format (default).
                 /text:* shows all object properties in detail view.
                 /text:<attribute> shows the value of the specified
                 attribute for each object.

J'ai élaboré que name était l'attribut correct en appelant:

appcmd list site /xml

Qui retourne au format XML (y compris les noms d'attributs):

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <SITE SITE.NAME="MyCompany.MyProject.WebRole_IN_0_Web" SITE.ID="1273337555" bindi
gs="https/555.555.555.555:443:" state="Started" />
</appcmd>
13
Tom Robinson