Link to home
Start Free TrialLog in
Avatar of afpcos
afpcos

asked on

CD - Autorun/ Install on first run

I want to burn an exe and setup program on a cd.  I want it
to autorun to install and then run the exe.  I then want
the exe to auto run each time the cd is placed into the computer.

Can anyone help me?
Avatar of deighton
deighton
Flag of United Kingdom of Great Britain and Northern Ireland image

Create a file called AUTORUN.INF

Place in it:

[AUTORUN]
open={anyprogram}.exe
icon={anyicon}.ico



You need anyprogram.exe to be a program that can detect if you've already installed your app, it could look for a key file or check for .ini file or registry setings.  It then has to call either the install or the installed VB program.
You can't right it in VB though cos it needs installing itself.




Avatar of mcrider
mcrider

Use this autorun.ini to start your program on all platforms... Replace readme.exe with the name of your program:

[AutoRun]
open=readme.exe
Shell\OpenCD\ = Start Master Setup
Shell\OpenCD\Command = readme.exe
icon = readme.exe,1

[AutoRun.PPC]
open=readme.exe
Shell\OpenCD\ = Start Master Setup
Shell\OpenCD\Command = readme.exe
icon = readme.exe,1

[AutoRun.Alpha]
open=readme.exe
Shell\OpenCD\ = Start Master Setup
Shell\OpenCD\Command = readme.exe
icon = readme.exe,1
Avatar of afpcos

ASKER

mcrider...

What do these two line actually do...

Shell\OpenCD\ = Start Master Setup
Shell\OpenCD\Command = readme.exe
Basically it sets up the environment for double-clicking the autorun icon... Some earlier versions of windows do not correctly support it just using the autorun "Open" all by itself.

Here is the writeup on autorun from microsoft...


Cheers!

Supporting AutoPlay
-------------------
Windows supports the ability to automatically run a file when the user inserts removable media that support insertion notification, such as CD-ROM, PCMCIA hard disks, or flash ROM cards. To support this feature, include a file named Autorun.inf in the root directory of the removable media. In this file, include the filename of the file to run, using the following syntax.

[autorun]
open = filename

Unless you specify a path, the system looks for the file in the root of the inserted media. If you want to run a file located in a subdirectory, include a path relative to the root; include that path with the file as in the following example.

open = My Directory\My File.exe

Running the file from a subdirectory does not change the current directory setting. The command-line string you supply can also include parameters or switches.

Because the autoplay feature is intended to provide automatic operation, design the file you specify in the Autorun.inf file to provide visual feedback quickly to confirm the successful insertion of the media. Consider using a startup up window with a graphic or animated sequence. If the process you are automating requires a long load time or requires user input, offer the user the option to cancel the process.

Although you can use this feature to install an application, avoid writing files to the user's local disk without the user's confirmation. Even when you get the user's confirmation, minimize the file storage requirements, particularly for CD-ROM games or educational applications. Consuming a large amount of local file space defeats some of the benefits of the turnkey operation that the autoplay feature provides. Also, because a network administrator or the user can disable this feature, avoid depending on it for any required operations.

You can define the icon that the system displays for the media by including an entry in the Autorun.inf file that includes the filename (and optionally the path) including the icon using the following form.

icon = filename

The filename can specify an icon, a bitmap, an executable, or a dynamic-link library file. If the file contains more than one icon resource, specify the resource with a number after the filename — for example, My File.exe, 1. The numbering follows the same conventions as the registry. The default path for the file will be relative to the Autorun.inf file. If you want to specify an absolute path for an icon, use the following form.

defaulticon = path

The system automatically provides a pop-up menu for the icon and includes AutoPlay as the default command on that menu, so that double-clicking the icon will run the Open = line. You can include additional commands on the menu for the icon by adding entries for them in the Autorun.inf file, using the following form.

shell\verb\command = filenameshell\verb = Menu Item Name


To define an access key assignment for the command, precede the character with an ampersand (&). For example, to add the command Read Me First to the menu of the icon, include the following in the Autorun.inf file.

shell\readme\command = Notepad.exe My Directory\Readme.txtshell\readme = Read &Me First


Although AutoPlay is typically the default menu item, you can define a different command to be the default by including the following line.

shell = verb

When the user double-clicks on the icon, the command associated with this entry will be carried out.



Avatar of afpcos

ASKER

I am looking for something that will run the setup if the program is not installed and/or then run the program.

This is just running the program.
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By the way, you can verify installation  just about any way you want to... I use SaveSetting in my programs to set a switch in the registry...

Then all I have to do is look in the registry for the switch an I know the program is installed.

Cheers!
If you dont want to write a program, you can autorun ".bat" files...

Just write a batch file to check for your program (look for a file).

Cheers!
Avatar of afpcos

ASKER

How can a vb program check to see if the main exe is installed if vb has not been installed in the first place?
if you use Main() as your startup and remove all the forms, compile to native form.... you should not have a problem.

of course, you can always modify the STARTUP1.EXE in the setupkit, and make your checks from there.


Cheers!
Avatar of afpcos

ASKER

mcrider...

Thanks for your help!!
thanks for every helper
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange