Share via


Sample .inf File

Cc960057.appen_h(en-us,TechNet.10).gif Cc960057.image-app(en-us,TechNet.10).gif

The following example shows an .inf file that performs a number of different actions:

; - Copies files to the Windows, System, Inf, and Help folders.
; - Makes a number of registry entries (including entries that 
;   will rename the copied files to long file names). 
; - Creates a link on the Help menu. 
; - Has an uninstall section that registers the uninstall 
;   action in the Add/Remove Programs dialog box in Control Panel. 
; - Uses replaceable strings to make localization easy. 

[Version]
Signature=$CHICAGO$ 

[DestinationDirs]
SampleCopy = 24,%PROGRAMF%\Sample
SampleDel = 24,%PROGRAMF%\Sample
SampleWinCopy = 25
SampleSysCopy = 11
SampleINFCopy = 17
sampleHLPCopy = 18 

[DefaultInstall]
CopyFiles = SampleCopy, SampleWinCopy, SampleSysCopy, SampleINFCopy, SampleHLPCopy
AddReg = SampleRegisterApp, SampleRegUninstall, SampleRenameFiles
UpdateInis = SampleAddLinks 

[RemoveSample]
DelFiles = SampleWinCopy, SampleSysCopy, SampleINFCopy, SampleHLPCopy
DelReg = SampleUnRegisterApp, SampleRegUninstall
AddReg = SampleRemoveLFNs
UpdateInis = SampleRemoveLinks 

[SampleCopy]
sample.bmp 

[SampleWinCopy]
sample.exe 

[SampleSysCopy]
sample.dll 

[SampleINFCopy]
sample.inf

[SampleHLPCopy]
sample.hlp 

[SampleRegisterApp]
;Makes an arbitrary registry entry (for private use of Sample.exe):
HKLM,Software\Sample,Installed,,"1" 

[SampleUnRegisterApp]
;Deletes the registry entry (note that this deletes the entire key):
HKLM,Software\Sample 

[SampleRegUninstall]
;Adds entry to the Add/Remove Programs dialog box in Control Panel 
;to uninstall the program:
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sample,"DisplayName",,"Sample Application"
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sample,"UninstallString",,"RunDll setupx.dll,InstallHinfSection RemoveSample 4 sample.inf" 

[SampleRenameFiles]
;Renames 8.3 file names to long file names:
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sample,,,"%24%\%PROGRAMF%\Sample"
HKLM,Software\Microsoft\Windows\CurrentVersion\RenameFiles\Sample,sample.bmp,,"Sample Bitmap.bmp" 

[SampleRemoveLFNs] 
;Deletes files with long file names during uninstall:
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Sample,,,"%24%\%PROGRAMF%\Sample"
HKLM,Software\Microsoft\Windows\CurrentVersion\DeleteFiles\Sample,sample.bmp,,"Sample Bitmap.bmp" 

[SampleAddLinks]
;Adds shortcut to Sample.exe on the Start menu:
setup.ini, progman.groups,, "Sample=%SampleFolder%" ;creates folder
setup.ini, Sample,, """%SampleDesc%"", %25%\SAMPLE.EXE" ;creates link

[SampleRemoveLinks]
;Removes shortcut to Sample.exe on the Start menu during uninstall:
setup.ini, progman.groups,, "Sample=%SampleFolder%" ;creates folder
setup.ini, Sample,, """%SampleDesc%""" ;deletes link 

[SourceDisksNames]
99 = %DiskName%,Sample,0

[SourceDisksFiles]
sample.exe = 1,,13456
sample.dll = 1,,20987
sample.bmp = 1,,64098
sample.hlp = 1,,55441
sample.inf = 1,,5687

[Strings]
PROGRAMF = "PROGRA~1"
SampleFolder = "Samples"
SampleDesc = "Sample Application"
DiskName = "Sample Application Installation Disk"

.