0
我正在写一个PowerShell脚本来自动化一些更新。Powershell通过“按任意键继续”从另一个脚本
为此,我需要执行另一个脚本并将输出保存到一个变量中。
之后,我可以将我需要的东西剪掉并保存到其他变量中。
这些事情在理论上是有效的,但我正在执行的另一个脚本会停止该进程,因为它需要任何密钥才能在最后继续。
有人知道我怎么能通过这个?
脚本停止后:
$list = .\list.cmd
亲切的问候:)
那是脚本的一部分:
Write-Host "Importing..."
cd "$path"
$list = .\list.cmd
Write-Host "Searching for the certificate file"
$CertificateFile = $list | where {$_ -match "Certificate File:"}
$CertificateFile = $CertificateFile.Substring(18)
Write-Host "I'm trying to find the Password File:"
$PasswordFile = $PasswordFile = $list | where {$_ -match "Password File:"}
$PasswordFile.Substring(15)
Write-Host "Searching for the password file"
$Enddate = $list | where {$_ -match "Validity NotAfter:"}
$Enddate = $Enddate.Substring(19)
你能发表list.cmd的内容吗? – mjolinor
只是改变list.cmd,所以它不需要按键? – Paul
你能分享一下你的总体目标吗?很有可能在PowerShell中这样做,而无需调用cmd.exe,尤其是考虑到您正在处理X.509证书管理工作。 –