【问题标题】:Why does cygstart start my browser as background process?为什么 cygstart 将我的浏览器作为后台进程启动?
【发布时间】:2021-10-16 14:51:19
【问题描述】:

当我 ssh 到 Windows 10 机器并使用 cygstart 打开应用程序时,它作为后台进程启动,即没有 UI 窗口。我无法将 UI 放在最前面,因为根本没有 UI。

示例:cygstart notepad.exe

我已经尝试了 --show--shownormal 的参数,但它们被忽略了。

我必须做什么才能使用 GUI 打开应用程序(这样我就可以使用远程桌面连接到该机器并修改那里发生的事情。背景信息:我正在使用这种方法通过以下方式启动 UI 测试chromedriver)?

【问题讨论】:

  • 这是 Windows 的一项功能(如果我没记错的话,从 W7 开始)他们阻止了 GUI 访问后台进程。
  • 如果您远程桌面到服务器并直接运行 sshd 服务器,而不是将其安装为系统服务,它可能会起作用。
  • 谢谢,一定是这样。缺点:每次自动系统重启都需要手动远程桌面登录。

标签: windows ssh cygwin


【解决方案1】:

这可能为时已晚,但您可以使用 shell 函数来保持应用程序打开。我在 bash 脚本中使用了cygstart 来使用记事本编辑备忘录,但我需要一个 bash 函数来保持 Cygwin 窗口打开,直到我在记事本中完成编辑。

cd path\to\memo.txt

cygstart -e memo.txt    # open the memo in Notepad  
holdEditorOpen          # keep Cygwin window open

holdEditorOpen () {
echo -e "   save your memo in Notepad window"
echo -e "               click File, Save"
echo -e "                then File, Exit to close NotePad"
echo -ne "   then in this window, press [Enter] key to proceed ..."
read    # no arg means dump next line of input
}

我不知道这是否适用于远程桌面连接,但如果您仍然需要答案,请尝试一下。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-07
    • 1970-01-01
    • 2018-06-14
    相关资源
    最近更新 更多