1

以下文件 test.cc 用于启动具有特定 URL 的 Microsoft Edge:

#include <Windows.h>

int main()
{
    SHELLEXECUTEINFOW sei = { sizeof sei };
    sei.lpVerb = L"open";
    sei.lpFile = L"microsoft-edge:http://www.stackoverflow.com";
    ShellExecuteExW(&sei);
}

编译:

cl test.cc /link shell32.lib

它适用于 Windows 10(Edge 打开到特定 URL),但在 Windows Server 2016 中,此程序会弹出一个错误窗口:

标题:microsoft-edge:http://www.stackoverflow.com

内容:This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.

我在控制面板中检查了“默认程序”,并在 Microsoft Edge 页面中选择了“将此程序设置为默认程序”。

4

0 回答 0