使用python的putty登录时无法设置标题。

问题描述 投票:0回答:1

我可以用下面的命令登录putty。

Popen("powershell kitty-0.73.1.1.exe [email protected] -pw password  -title Firstsession")

Popen("powershell kitty-0.73.1.1.exe [email protected] -pw password  -title Secondsession")

问题是我无法为powershell设置标题,在执行过程中,我可以看到上面命令中提到的标题(Firstsession, Secondsession),但一旦用户成功登录,标题就会被清除,标题显示为

名称@CentOS-7-App:~。

在powershell中

我甚至尝试了-classname,但还是无法得到想要的标题。

Popen("powershell kitty-0.73.1.1.exe [email protected] -pw password  -classname Firstsession")

我指的是这个网站的参数传递

https://www.9bis.net/kitty/#!pages/CommandLine.md 
python powershell putty
1个回答
0
投票

我从来没有听说过kitty-0.73.1.1.1.exe,直到现在,虽然我一直在使用putty。我打算假设,-title是kitty-0.73.1.1.exe的东西,因为。PowerShell没有-Title开关来设置控制台主机标题栏。

要改变PowerShell控制台主机标题,命令是。

$host.ui.RawUI.WindowTitle = 'Changed Title'

https:/docs.microsoft.comen-usdotnetapisystem.management.automation.host.pshostuserinterface.rawui。

即使是这样也不会显示,直到控制台主机已经完全加载,意味着处理任何用户配置文件的东西。

所以,从cmd.exe,这将很快工作......。

powershell -noexit -noprofile $host.ui.RawUI.WindowTitle = 'Changed Title'

然而,如果你的配置文件中有一堆东西......

powershell -noexit $host.ui.RawUI.WindowTitle = 'Changed Title'

......它将需要更长的时间来改变标题。

然而,你的问题似乎表明你是想改变putty控制台的标题栏,我不知道为什么人们会相信PowerShell能够交互式地改变另一台主机的环境。你可以使用PowerShell来启动外部程序,但剩下的工作要由程序来完成。

© www.soinside.com 2019 - 2024. All rights reserved.