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

前端 未结 6 1332
梦毁少年i
梦毁少年i 2020-12-09 06:10

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 wa

相关标签:
6条回答
  • 2020-12-09 06:20

    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.

    0 讨论(0)
  • 2020-12-09 06:22

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

    [autorun]
    shellexecute=path\to\htmlfile.html
    
    0 讨论(0)
  • 2020-12-09 06:26

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

    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.

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

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

    0 讨论(0)
  • 2020-12-09 06:33

    I used (the free version of) 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 :

    [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

    0 讨论(0)
  • 2020-12-09 06:39

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

    0 讨论(0)
  • 2020-12-09 06:41

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

    0 讨论(0)
提交回复
热议问题