Autorun. inf and its command details

Source: Internet
Author: User
Autorun. inf and its command details

We already know that you can use intellirun. inf to specify the icons and running files automatically loaded on the CD,
In fact, autorun. inf is very useful,
The following describes the application of autorun. inf in detail.

Learn about autorun. inf
What is Autorun. INF file, strictly speaking, it is a text file that must be stored in a certain format under the root directory of the drive. It is composed of one or more "sections, each "section" must start with the section name. The section name must be enclosed in brackets [], and the section name is the command in this section.
Autorun. inf supports three sections, including [Autorun], [Autorun. Alpha], and [deviceinstall]. Only [Autorun] must exist.

Instance application
Now let's take an instance to learn more about the functions of the autorun. inf file.
(1) Automatic Operation
The automatic running is exposed in the previous article, that is, using the open command. Note that the file specified by "open =" must be an executable file, such as COM, EXE, and bat; if the specified file is not in the root directory, you must specify its path, for example, open = soft. bat, which indicates 1. BAT file.
TIPS: if the file to be run is not com, EXE, or bat, it doesn't matter. We can compile a BAT file manually, add the path and file name of the file to be opened to bat.
(2) custom disc icons
In the autorun section, there is another interesting command line, which is the icon. Generally, the specified icon file can be in ICO and BMP formats, of course, it can also be an EXE and DLL files containing ICON resources. If the EXE and DLL files contain multiple Icon files, you must specify the icon index number you want to use, note that the icon index number starts from 0, for example, "icon = icon. DLL, 1 ", it indicates the icon will be used. the second icon in the DLL file.
Tip: the icon can be used not only on the CD, but also in the autorun. inf file in the root directory of the hard disk.
(3) custom volume label
Although generally, you can set the disc flags in the CD recording software, if you want to bulk burn the files, it will be very troublesome. It is better to use command-defined shortcuts.
The label command is used to define the volume label. Its syntax is the same as that of open and icon.
(4) Add a shortcut menu
When we right-click the burned disc, we often find an automatic playback option in the right-click menu. In fact, this mainly uses Autorun. in INF, you can add other menu commands as needed.
The format for adding other menu commands is "shell <menu command name> command = <file to be executed>". For example, we have compiled a file with the following content:
[Autorun]
Shellopen the cmdname notepad.exe
In this way, when we burn the file into the disc, right-click the disc and a "Open Notepad" command will appear in the pop-up menu.
(5) change the default operation
In general, the default double-click operation of the application autorun. inf disc is mostly automatic playback, that is, the file operations after open. In fact, we can also change this situation, which is also accomplished using shell commands.
Let's take a look at a typical double-click installation example:
[Autorun]
Shellsetupcommand=softsetup.exe
Shell eadme = install software
Shell = setup
To understand this statement, we can look at it from the bottom up. When we double-click the disc, the last shell = setup statement will be called because the sentence is set, when you double-click it, the corresponding ghost file will be searched.

Here we mainly introduce the application of the autorun section content, and for Autorun. alpha is rarely used, while deviceinstall can only be used in Windows XP. It can be used to specify subdirectories for recursive search in the hardware wizard.

Theoretical Basis

Friends who often use CDs know that many CDs run automatically when they are put into the optical drive. How do they do this? The CD will be automatically executed when it is put into the optical drive, mainly relying on two files, one is the autorun. inf file on the CD, and the other is one of the system files of the operating system itself, cdsealing. VxD. Cdsealing. VxD will detect whether there is any action in the optical drive at any time. If so, you can find the autorun. inf file under the root directory of the optical drive. If the autorun. inf file exists, execute the preset program in it.

Autorun. INF not only allows the CD to run programs automatically, but also allows the hard disk to run programs automatically. The method is very simple. Open notepad, right-click the file, and select "RENAME" in the pop-up menu ", rename it Autorun. INF, in autorun. type the following content in INF:

[Autorun] // indicates that the autorun part starts and must be entered
Icon = C:/C. ICO // a personalized drive letter icon for drive C. ICO
Open = C:/1.exe // specifies the region and name of the program. Here, 1.exe is under the C drive.

Hosts file!
The "[Autorun]" line must be in a fixed format. The "icon" line corresponds to the icon file, "C:/C. ICO "is the icon file path and file name. You can change it to the path and file name of your image file when entering it. In addition, ". ICO is the extension of the icon file. If you do not have such files on hand, you can use ACDSee to convert the software in other formats to the ICO format, or find a file with the suffix BMP, rename it to the ICO file.

The "open" line specifies the file to be automatically run and its drive letter and path. Note that if the hard disk and directory you want to change do not have an automatic playback file, you should delete the "open" line, otherwise, the hard disk cannot be opened because the automatic playback file cannot be found. You can only right-click the drive letter and select "open" in the pop-up menu.

I believe that after learning this article, you will surely be able to broaden your horizons. In fact, in addition to the introduction in this article, there are many wonderful applications waiting for you to explore. You need to know that learning is the door for the master. The practice depends on the individual, and the rest depends on you.

In addition, Autorun can be exploited by hackers. we can disable automatic operation to prevent it from acting.

Method

Disable Automatic Running of Hard Disk: Open the HKEY_CURRENT_USER/software/Microsoft/Windows/CurrentVersion/Replies/exploer primary key in the registry editor. The binary value "NoDriveTypeAutoRun" in the right window determines whether to execute the autorun function, change the default key value of "NoDriveTypeAutoRun" from 95, 00 to 9d, 00, and then close the Registry Editor and restart the computer.
Only automatic operation of the disc is prohibited. You can change the "NoDriveTypeAutoRun" key value to BD, 00

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.