我正试图通过ssh连接(进入Win10机器)在我的计算机上启动一个steam游戏。在本地运行时,以下python调用可以工作
subprocess.run("start steam://rungameid/[gameid]", shell=True)
然而,每当我通过ssh连接在交互式解释器中或通过调用目标机器上的脚本来运行它时,我的steam客户端就会突然退出
我在steam日志中没有注意到任何东西,除了中Steam\logs\connection_log.txt
每次都包含注销和新会话启动。这是而不是在我的机器上本地运行命令时的情况。为什么蒸汽知道该命令的不同来源,为什么这会导致蒸汽连接下降?有人能提出解决办法吗
谢谢
Steam可能无法启动应用程序,因为Windows服务(包括OpenSSH服务器)无法访问桌面,因此无法启动GUI应用程序。据推测,Steam不希望在无法与桌面交互的环境中运行应用程序,这就是最终导致Steam崩溃的原因。(无可否认,这只是一个猜测,很难确定当崩溃似乎没有出现在日志或崩溃转储中时到底发生了什么。)
您可以通过domih到this question关于在Windows上通过SSH运行GUI应用程序,看到一个更详细的解释,解释了当服务器作为Windows服务在this answer中运行时,通过SSH启动GUI应用程序失败的原因
多米还提出了一些解决办法。如果这是您的一个选项,最简单的方法可能是手动下载并运行OpenSSH服务器,而不是将服务器作为服务运行。您可以找到最新版本的Win32 OpenSSH/Windows for OpenSSHhere
另一个似乎仍然有效的解决方法是使用
schtasks
。其思想是创建一个运行命令的计划任务,任务调度器可以访问桌面。不幸的是,如果你不介意至少等到下一分钟,这只是一个可以接受的解决方案schtasks
只能将任务精确地安排在一分钟内执行。此外,为了在任何时候都能安全地运行,代码可能应该将任务调度到至少一分钟以后,这意味着等待时间可能在1-2分钟之间这种方法还有其他缺点。例如,以这种方式监视正在运行的进程可能会更困难。但是,在某些情况下,它可能是一个可接受的解决方案,因此我编写了一些Python代码,可用于使用
schtasks
运行程序,并提供了一个示例。代码取决于shortuuid
包的大小;您需要在尝试该示例之前安装它相关问题 更多 >
编程相关推荐