【发布时间】:2019-04-08 23:19:52
【问题描述】:
基本上我想在同一个窗口中切换powershell中的用户(不想打开一个新的)。
$username = "xxxxx"
$password = ConvertTo-SecureString "xxxxx" -AsPlainText -Force
$creds = New-Objet System.Management.Automation.PSCredential $username,$password
Start-Process powershell.exe -NoNewWindow -Credential $creds
但不是在同一个窗口中启动 powershell,而是在一个甚至不起作用的新窗口中启动它,我无法在它只是一个闪烁的光标中输入任何内容。
【问题讨论】:
-
您不能在这样的不同上下文中的进程中运行进程。
-
@TheIncorrigible1 除了在 Powershell 中切换用户还有其他方法吗?
-
在同一个主机内?据我所知没有。
标签: windows powershell powershell-1.0