Sometimes we need to make a CD and want it to be Autorun. Here I will introduce a free cd tool (infrarecorder) and explain How to Write autorun. inf.
First, you need to prepare all the files required for CD. Generally, a simple Autorun CD includes the following files:
1. Files requiring Autorun. EXE, bat, and any files that can be opened.
2. In an autorun. inf file, the OS will have a resident program to monitor any hot swapping devices, such as CD. After the OS detects the device, it checks whether the file in the device contains the autorun. inf file. If yes, the content in autorun. inf will be executed.
3. Other resource files, such as icons.
An autorun. inf file has the following syntax:
The structure consists of three parts: [Autorun] [Autorun. Alpha] [deviceinstall]
[Autorun] Applicable to Windows 95 and above systems and 32-bit CD-ROM, required.
[Autorun. Alpha] It is applicable to the Computer Optical Drive Based on the server learning Ram role. It is applicable to Windows NT 4.0 and is optional.
[Deviceinstall] Applicable to Windows XP and later systems. Optional.
I only excerpted some content about Autorun in Baidu encyclopedia. An autorun. inf with Autorun is enough to implement Autorun.
[Autorun] // indicates the beginning of the autorun part.
Icon = x: \ "icon". ICO // you can specify an icon for disk X.
Open = x: \ Program cmd.exe or "command line" // double-click the program or command executed on disk x
Shell \ "keyword" = "add displayed content to the right-click menu" // Add options to the right-click menu
Shell \ "keyword" \ command = "file to be executed or command line" // select the program or command to be executed by Adding options in the right-click menu
Some Autorun commands and their details 1. defaulticon
Description: Default icon of the application.
Format:
Defaulticon = icon pathname [, serial number]
Parameters:
Icon file name: the name of the application. Format: .icow.bmp. .exe and. dll. When the file format is .exe and. dll, the serial number is sometimes used to specify the icon.
Serial number: when the file format is .exe and. dll, the file may include an extra icon. In this case, you need to use the serial number to specify the icon. Note that the serial number starts from 0.
Note:
The default icon of the application is displayed in the driver display window of the Windows Explorer core instead of the default icon of the device.
The default directory of the icon path name is the device root directory.
2. icon
Meaning: Specify the display icon of the device.
Format:
Icon = icon pathname [, serial number]
Parameters:
Icon file name: the name of the application. Format: .icow.bmp. .exe and. dll. When the file format is .exe and. dll, the serial number is sometimes used to specify the icon.
Serial number: when the file format is .exe and. dll, the file may include an extra icon. In this case, you need to use the serial number to specify the icon. Note that the serial number starts from 0.
Note:
The device display icon is displayed in the driver display window of the Windows Explorer core instead of the default icon of the device.
The default directory of the icon path name is the device root directory.
This command is invalid when the default application icon (defaulticon) exists.
3. Label
Description: Device description.
Format:
Label = Description
Parameters:
Description: any text, which can contain spaces.
Note:
The device description is displayed in the driver display window of the Windows Explorer core instead of the default description volume of the device.
In the driver display window of a non-Windows Explorer core (for example, right-click the device and select Properties), the volume label of the device is displayed.
4. Open
Meaning: Specifies the command line that is run when the device is enabled.
Format:
Open = command line
(Command line: Program path name [parameter])
Parameters:
Command Line: the command line that runs automatically. The command line is the. exe).com;.batfile, which can be opened using start.exe or ShellExecute.
Note:
The START directory of the command line is the root directory of the device and the $ PATH environment variable of the system.
5. ShellExecute
Meaning:
Specifies the file to be executed when the device is enabled. (Unknown Operating System Support)
Format:
ShellExecute = Execution file path name [parameter]
Parameters:
Execution file path: the name of the execution file when the device is enabled. It can be a file in any format. The system calls the set program to execute this file.
Parameter: parameter, which is adjusted according to the execution File
Note:
The START directory of the command line is the root directory of the device and the $ PATH environment variable of the system.
6. Shell \ keyword \ command
Meaning:
Right-click the device and choose execute command line.
Format:
Shell \ keyword \ command = command line
(Command line: Program path name [parameter])
Parameters:
Command Line: the command line automatically runs. The command line is the. exe).com;.batfile, which can be opened using start.exe.
Note:
The START directory of the command line is the root directory of the device and the $ PATH environment variable of the system.
7. Shell \ keywords
Meaning: define the context menu text of a device.
Format:
Shell \ keyword = text
Parameters:
Keyword: used to mark menus. It can be expressed by any character, including spaces.
Text: The text displayed in the right-click menu. It can contain any character and cannot contain spaces.
Note:
In the same autorun. inf file, different context menu keywords are different, and the same context menu keywords are the same.
You can use &; To set the acceleration key in the right-click menu text and Output &.
The shell keyword command shell keyword is indispensable, and the order does not matter.
When the open, ShellExecute, and shell commands are not available, the first device right-click menu to specify the command is run when the device is enabled.
8. Shell
Meaning: Right-click the device that runs when the device is enabled.
Format:
Shell = keyword
Parameters:
Keywords: marked menu keywords
Note:
The keywords specified by shell can be in any part of the autorun. inf file.
The priority defined after open, ShellExecute, and shell commands is high.
9. Action
This command is used to define the program name, for example:
[Autorun]
ShellExecute = rundll32 ght
Action = open a folder
The right-click menu displays "Open folder", and the executed command is "rundll32 ght"
10. Notes
Like other INF files, the content after ";" is used as a comment and does not participate in compilation.
Then, you need to go to the official website to download an infrarecorder, the official website address: http://infrarecorder.org/
After the download and installation are complete, start the program.
Click data disc to create a data CD.
For example, select a file from the local file system and the structure of the selected file in CD.
The bottom right is the display name of the CD, which can be modified, but the name should not be too long. Otherwise, the display will be truncated, and the maximum length is about 20 characters.
Under actions, you can choose whether to burn data directly to a writable CD or create an ISO.
The content of my rutorun. inf is as follows:
1: [AutoRun]
2: open‑xxxx.exe // if the open object is MSI, use ShellExecute = XXXX. MSI
3: ICON=YYYY.ico