Как передать пароль в качестве параметра в сценарии Powershell - PullRequest
0 голосов
/ 18 июня 2020

У меня есть следующие настройки параметров, и я пытаюсь передать их в пароль 7zip, как показано в сценарии. Причина, по которой я установил параметр: мне нужно указать текущий месяц плюс оставшуюся часть пароля.

Script

$Password = $MonthFull+$year+"#Test"

Start-job -scriptblock {
    param($p_output_zip_file, $p_exported_files)
    Set-Alias SZ "C:\Program Files\7-Zip\7z.exe" 
    **SZ a $p_output_zip_file $p_exported_files -sdel -p'Jun2020#Test'** -- I need this to pick up the current month plus the rest of the password

} -name "Compress_File" -ArgumentList "$output_zip_file","$exported_files" | Out-Null

Спасибо

1 Ответ

0 голосов
/ 18 июня 2020
$('-p' + ('{0:MMMyyyy}{1}' -f (Get-Date), '#Test')) 
...