Use of the CD-ROM AutoRun Functionality to Open HTML, PDF and Other Documents
TOPIC
Q: I would like a data file (HTML, PDF, Word, PowerPoint, Flash, AVI, MPEG, etc.) to be opened when my CD is inserted. Can I simply use "OPEN=Start ...", "OPEN=explorer.exe ..." or "ShellExecute=..." in Autorun.inf, or is MenuBox better?
DISCUSSION
A: Microsoft's original AutoRun specification, first was first implemented in Windows 95, defined how executable files (e.g. EXE files, but not document files) could be launched via an "Open=" entry in the "Autorun.inf" file. MenuBox extends this functionality by also allowing documents to be automatically opened when the medium is inserted in the drive.
This article compares various approaches which do not resort to third-party add-ons. These approaches, which all have various limitations, include:
- Use of the Open key (including Open=Start and Open=Explorer)
- Use of the ShellExecute key
- Use of the Windows Script Host
- Use of batch files
The Open key can only be used to run an executable, not a document file. For this reason writing "Open=documentname" in the Autorun.inf file (e.g. "Open=MyDocument.html") does not work.
In Windows 2000 Microsoft introduced the "ShellExecute=" key, which made it possible to also open documents (e.g. HTML, PDF, etc.) with their default viewer. The "ShellExecute" approach is often discussed in newsgroups as a possible solution to automatically launch document files (e.g. HTML, etc.) when a medium is inserted in the drive. Unfortunately this option will only work on Windows 2000, Windows Me, Windows XP, Windows Server 2003 and higher, which have version 5 or higher of the "Shell32.dll" file, but it will fail on Windows NT 4.0, Windows 95 and Windows 98. You can use MenuBox to overcome this limitation by entering "Open=MenuBox documentname" instead of "ShellExecute=documentname" in your Autorun.inf file. Using MenuBox in this way is completely free.
The opposite applies to the "Open=Start documentname" solution, which works fine on Windows 95, Windows 98 and Windows Me, but which fails on Windows NT 4.0, Windows 2000, Windows XP, Windows Server 2003 and Windows Vista. This is because this method relies on the presence of a file named "Start.exe", which is not available on newer versions of Windows (where Start remains a valid shell command, but it is implemented directly in the command processor, rather than as a separate file). Also, the "Open=Start" method causes a black shell window to be briefly opened, which does not look very professional. You can use MenuBox to overcome all of these limitations by entering "Open=MenuBox documentname" instead of "Open=Start documentname" in your Autorun.inf file. Using MenuBox in this way is completely free.
Another proposed solution has been to use the Windows Script Host to interface with the command processor via JScript or VBScript, which avoids the opening of the shell window, but adds a new limitation: the Windows Script Host is not installed on older versions of Windows such as Windows 95 and Windows NT 4.0.
A similar method which is sometimes proposed as a solution to AutoRun HTML and other files is the invocation of a batch file, e.g. "Open=MyBatchFile.bat", "Open=ShellExecute.bat documentname", etc., where the batch file in turn runs other commands. This method too only works on Windows 9x class systems, and fails on Windows NT 4.0, Windows 2000, Windows XP, Windows Server 2003 and Windows Vista.
Another solution which has been proposed to open a document without resorting to a startup application such as MenuBox is to invoke "Open=Explorer documentname" (note: the command used here is "Explorer", or "Explorer.exe", not "Explore") Unfortunately this method too has at least one known drawback, as Explorer does not always take into consideration user preferences such as the default web browser (e.g. it always uses Internet Explorer to open HTML documents, even if Netscape is set as the default). As there have been some public discussions about whether this problem applies or not, we burned a CD-ROM and verified that this problem does indeed exist. Our test configuration consisted of a Windows 98 system with Internet Explorer 5.5; Netscape Navigator 3.0 was verified to be the default program when double-clicking an HTML document icon, yet the same HTML document was being opened with Internet Explorer when invoked via "Open=explorer.exe test.html". Additionally, the same AutoRun entry resulted in a "The path CDROMDRIVE:\test.html does not exist or is not a directory." error when played on Windows 95 and Windows NT 4.0 systems.
MenuBox was designed to overcome all of the above limitations, plus several other potential problems, while at the same time implementing powerful additional features not found in other tools. MenuBox also fully supports newer versions of Windows, including Windows 11, Windows 10, Windows 8 and Windows 7 and modern features like High-DPI displays, "Run enhanced content", etc.
Related Links
ARTICLE INFORMATION
Article ID: | 13-157 |
---|---|
Platform: | Windows |
Products: | MenuBox |
Additional Keywords: | autostart, autoplay, cdrom, cdr, dvd, director |
Last Update: | 2018-03-20 |
It is safe to link to this page.