PowerShell - Bludwarf/CodeBank GitHub Wiki

Variables

Tableau de paramètres

[string[]]$scripts = If ($dropSchema) {
    @("drop_schema.sql", "init.sql")
} Else {
    @("init.sql")
}
$fileParameters = $scripts | ForEach-Object { "--file=$_" }

Mots-de-passe

Paramètre :

param(
    ## Mot-de-passe
    [Parameter(mandatory = $true, HelpMessage = "Mot-de-passe")]
    [SecureString]
    $password
)

Déchiffrement pour obtenir le mot-de-passe en clair :

$password_clear = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($password))

Modifier l'historique

Modifier le fichier renvoyer par la commande :

(Get-PSReadlineOption).HistorySavePath

source