InstallContext.IsParameterTrue(String) Método

Definición

Determina si el parámetro especificado de la línea de comandos es true.

public:
 bool IsParameterTrue(System::String ^ paramName);
public bool IsParameterTrue (string paramName);
member this.IsParameterTrue : string -> bool
Public Function IsParameterTrue (paramName As String) As Boolean

Parámetros

paramName
String

Nombre del parámetro de la línea de comandos que se va a comprobar.

Devoluciones

Es true si el parámetro especificado está establecido en "yes", "true", "1" o una cadena vacía (""); en caso contrario, false.

Ejemplos

Este ejemplo es un extracto del ejemplo en la información general de la InstallContext clase .

Usa el IsParameterTrue método para averiguar si se ha establecido el LogtoConsole parámetro . Si yeses , usará el LogMessage método para escribir mensajes de estado en el archivo de registro de instalación y en la consola.

// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext->LogMessage( "The 'Install' method has been called" );
}
// Check whether the "LogtoConsole" parameter has been set.
if( myInstallContext.IsParameterTrue( "LogtoConsole" ) == true )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage( "The 'Install' method has been called" );
}
' Check wether the "LogtoConsole" parameter has been set.
If myInstallContext.IsParameterTrue("LogtoConsole") = True Then
   ' Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage("The 'Install' method has been called")
End If

Comentarios

Este método tiene acceso a la Parameters propiedad , que contiene una versión analizada de los parámetros de la línea de comandos, para determinar si el parámetro especificado es true.

Se aplica a

Consulte también