How to make an html page open automatically on a CD/DVD
Question
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?
Solution
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
OTHER TIPS
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
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.
ShelExec is your ticket. It is free and allows you to specify an optional ico file too.
It's dead simple. I use a program called Autorun Pro. Check out this guide.
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.