We recommend using Visual Studio 2017

/STUB (MS-DOS Stub File Name)


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at -STUB (MS-DOS Stub File Name).


## Remarks  
 An MS-DOS application.  
## Remarks  
 The /STUB option attaches an MS-DOS stub program to a Win32 program.  
 A stub program is invoked if the file is executed in MS-DOS. It usually displays an appropriate message; however, any valid MS-DOS application can be a stub program.  
 Specify a *filename* for the stub program after a colon (:) on the command line. The linker checks *filename* and issues an error message if the file is not an executable. The program must be an .exe file; a .com file is invalid for a stub program.  
 If this option is not used, the linker attaches a default stub program that issues the following message:  

This program cannot be run in MS-DOS mode.

 When building a virtual device driver, *filename* allows the user to specify a file name that contains an IMAGE_DOS_HEADER structure (defined in WINNT.H) to be used in the VXD, rather than the default header.  
### To set this linker option in the Visual Studio development environment  
1.  Open the project's **Property Pages** dialog box. For details, see [Setting Visual C++ Project Properties](../Topic/Working%20with%20Project%20Properties.md).  
2.  Click the **Linker** folder.  
3.  Click the **Command Line** property page.  
4.  Type the option into the **Additional Options** box.  
### To set this linker option programmatically  
-   See [AdditionalOptions](assetId:///P:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions?qualifyHint=False&autoUpgrade=True).  
## See Also  
 [Setting Linker Options](../Topic/Setting%20Linker%20Options.md)   
 [Linker Options](../Topic/Linker%20Options.md)