如何在 CD/DVD 上自动打开 html 页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/735412/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:35:50  来源:igfitidea点击:

How to make an html page open automatically on a CD/DVD

htmldvdcd

提问by Adam Rosenfield

I need to include an html page (table of contents) on a CD/DVD. I'd like the html page to open automatically when the user puts the CD/DVD in their machine. Is there a way to do this (the MSDN cds do this) either by purchasing software or otherwise?

我需要在 CD/DVD 上包含一个 html 页面(目录)。当用户将 CD/DVD 放入他们的机器时,我希望 html 页面自动打开。有没有办法通过购买软件或其他方式来做到这一点(MSDN cds 做到这一点)?

采纳答案by Peter

I used (the free version of) AutoRunPro

我使用(免费版)AutoRunPro

I remember when I was confronted with the problem once

记得有一次遇到这个问题

[autorun]
shellexecute=path\to\htmlfile.html

just wouldn't work on most PC's. I used a program called AutorunPro.EXE, just copied it in the root, and the autorun.inf was :

只是不能在大多数 PC 上工作。我使用了一个名为 AutorunPro.EXE 的程序,只是将它复制到根目录中,并且 autorun.inf 是:

[Autorun]
open=AutoRunPro.exe

[AutorunPro]
; Here are some sample uses for Autorunpro. It keeps processing Them in Run1..RunN         order until it doesnt find one.
Run1=index.htm
Run2=.

Moreover, you can open several programs, pages, ... with this method in one go.

此外,您可以使用此方法一次性打开多个程序、页面……。

In either case : test your method beforehand, you don't actually have to burn a CD/DVD in order to do that : look here

在任何一种情况下:事先测试您的方法,实际上您不必刻录 CD/DVD 来执行此操作: 请看这里

回答by Adam Rosenfield

You should be able to do with a relatively simple autorun.inffile in the CD/DVD's root directory:

您应该可以使用autorun.infCD/DVD 根目录中的一个相对简单的文件:

[autorun]
shellexecute=path\to\htmlfile.html

回答by Benjamin Autin

If you don't want to trust to third party programs, or skip over them entirely you can read the MSDN AutoRun Reference. It's not too bad.

如果您不想信任第三方程序,或者完全跳过它们,您可以阅读MSDN AutoRun 参考。还不错。

回答by Dave Johnson

ShelExecis your ticket. It is free and allows you to specify an optional ico file too.

ShelExec是您的门票。它是免费的,也允许您指定一个可选的 ico 文件。

回答by Wojciech Jakubas

You can create simple executable yourself. In Visual Studio in example.

您可以自己创建简单的可执行文件。以 Visual Studio 为例。

Not sure it can be call one-liner but it is not far from it :-)

不确定它是否可以称为单线,但离它不远:-)

#include "stdafx.h"
#include "windows.h"
#include "Shellapi.h"

int main(int argc, char* argv[])
{
    ::ShellExecute(NULL, "open", "path\to\htmlfile.html", 0, 0, SW_NORMAL);
    return 0;
}

To avoid hard-coding you can try passing path as a parameter in command line.

为了避免硬编码,您可以尝试在命令行中将路径作为参数传递。

autorun file must be added to the CD. File can look like this.

必须将自动运行文件添加到 CD。文件看起来像这样。

[autorun]
icon=\MySexyIcon.ico
label=MySuperCD
open=YourExecutable.exe

Please bear in mind that it will not work on iOS though.

请记住,它不适用于 iOS。

回答by Tom Wright

It's dead simple. I use a program called Autorun Pro. Check out this guide.

太简单了。我使用一个名为 Autorun Pro 的程序。查看本指南