Back to the DOSBox-X Wiki Welcome page.

Clipboard Support in DOSBox-X

Overview

DOSBox-X has support for copying to and pasting from the host system clipboard in several ways. For example, you can copy to or paste from to the clipboard inside DOSBox-X using the right/middle mouse buttons, arrow keys or mapped keyboard shortcuts, and you can also use a DOS device or DOS program to communicate bidirectionally with the host clipboard. You will find a menu group Shared clipboard functions under the "Main" menu to control the various options for the clipboard feature.

Clipboard support for double-byte (DBCS) characters used by Chinese/Japanese/Korean languages is fully supported when using these code pages, although clipboard copying and pasting using mouse buttons or arrow keys is not available for the Linux SDL1 build.

Select, copy and paste text using a mouse button

Note: This functionality is not available on Linux SDL1 builds.

You can also use a mouse button to easily select, copy or paste text to or from the clipboard in DOSBox-X when the mouse is not locked. The default mouse button is the right mouse button, but it can be set to the middle mouse button or to disable the feature with the clip_mouse_button config option in the [sdl] section of the DOSBox-X config file. With this feature enabled you can right-drag (or middle-drag) on text in the DOSBox-X window and release the mouse to copy to the clipboard; right-click (or middle-click) in the DOSBox-X window to paste from the clipboard. It works even for double-byte characters when DOSBox-X is running in the PC-98/JEGA mode or a CJK code page. During the text selection you can always left-click (or press the ESC key) to cancel the selection.

It is possible to set a keyboard modifier for this feature by editing the clip_key_modifier config option in the [sdl] section of the DOSBox-X config file so that you can use Alt+Right-click, Ctrl+Right-click, Shift+Right-click, etc. to select, copy and paste text instead. The default keyboard modifier for this feature in DOSBox-X is Shift, but you can change it to a different one or setting the clip_key_modifier config option to none if no keyboard modifier is desired. You can also check the option "Quick edit: copy on select and paste text" within the "Shared clipboard functions" menu group to bypass any keyboard modifier that may have been set (same effect as clip_key_modifier=none when this menu item is checked).

There is no practical limit on the clipboard size when doing the pasting. But the speed of pasting each character does matter in some cases, even though the default speed works fine for many programs (such as WordPerfect 5.1). Depending on the DOS program you are using, pasting too fast for example can cause lost keystrokes for some programs. Thus, there is a setting named clip_paste_speed in the [sdl] section of DOSBox-X’s config file which can be used to set the speed for pasting each character from the clipboard. The default setting is 30, but if this setting does cause lost keystrokes in your application, you can increase the number to slow down the pasting. Conversely, you may experiment with decreasing the number for applications that accept keystrokes quickly.

Select, copy and paste text using the keyboard

Note: Pasting from the clipboard using a keyboard shortcut is supported in all platforms. Selecting and copying text using the keyboard are supported in all except for the Linux SDL1 build.

The keyboard can also be used to select, copy text to and paste text from the clipboard. If you select "Via arrow keys (Home=start, End=end)" in the "Shared clipboard functions" menu group, or if you enable it with the config option clip_mouse_button set to arrows, then you could use the arrow keys (left, right, up, down) to select text to be copied to the host clipboard; press the Home key (or Function+Shift+Left arrow on a Mac laptop) to start the actual selection, and press the End key (or Function+Shift+Right arrow on a Mac laptop) when the text selection is finished, then the selected text will be copied to the clipboard. During this you can press the ESC key to cancel the text selection. These keys are subject to the keyboard modifier as specified by the clip_key_modifier config option, but the keyboard modifier can be bypassed by enabling the "Quick edit: copy on select and paste text" option (also from the "Shared clipboard functions" menu group), similar to the mouse method.

In addition to text selection and copy functions, you can also use a keyboard shortcut (Ctrl+F6 by default) to paste text from the clipboard into DOSBox-X, or just click the option "Pasting from the clipboard" within the "Shared clipboard functions" menu group. You can change the keyboard shortcut with DOSBox-X’s mapper editor if desired. One way to run the mapper editor is to start DOSBox-X.exe with the -startmapper command-line option. You can also select it directly from DOSBox-X’s drop-down menu (under "Main"). After the mapper editor is launched, click the "Paste Clipboard" function and assign a keyboard shortcut to it. In any case, you can use the saved keyboard shortcut to paste text from the clipboard into DOSBox-X just like pasting it using the right mouse button click.

Similar to pasting text using the right mouse button, you can change the speed for pasting each character from the clipboard to DOSBox-X via the clip_paste_speed setting in the [sdl] section of DOSBox-X’s config file. As mentioned in the previous section the default value (30) works for many programs, but for some programs you may need to change it from the default one. The higher the value of this setting, the slower each character will be pasted from the clipboard. You can also decrease this value if your DOS program accepts keystrokes quickly. Moreover, when you are pasting long clipboard content you can always force it to stop in the middle with the "Stop clipboard pasting" menu option.

Note: If you want to paste clipboard text into Windows 3.x/9x applications (e.g. Notepad and Write), please make sure the "Use BIOS function for clipboard pasting" option within the "Shared clipboard functions" menu group is not selected. This option can also be changed via the clip_paste_bios setting in the [sdl] section of DOSBox-X’s config file.

Copy and paste text using a DOS device

Note: This functionality is limited to read-only access on the Linux SDL1 build.

You can use a DOS device (e.g. CLIP$) to easily copy text to and/or paste text from the clipboard in DOSBox-X. To activate this function, please make sure the "Enable DOS clipboard device access: CLIP$" toggle within the "Shared clipboard functions" menu group is checked. Alternatively, you can enable it via the dos clipboard device enable setting in the [dos] section of the DOSBox-X config file (e.g. dosbox-x.conf) by setting it to true or full, then a DOS device (default name: CLIP$) will be added to DOSBox-X to allow bidirectional communications with the clipboard.

For example:

DIR >CLIP$

Will redirect the directory listing to the clipboard;

VER >>CLIP$

Will append the version information to the clipboard;

TYPE CLIP$

Will display the content of the clipboard;

EDIT CLIP$

Will open the editor with the clipboard content;

SORT <CLIP$

Will sort the clipboard content using the SORT command.

You may also set the dos clipboard device enable config option to either read or write to allow only read or write access for security reasons. The DOS device name can also be changed with the dos clipboard device name config option if you want to use a different device name from CLIP$.

This bidirectional clipboard access will be deactivated if the secure mode for DOSBox-X is enabled, and it will also not work if booting into a guest OS.

Copy and paste text using a DOS program

Note: This functionality is limited to text pasting on the Linux SDL1 build.

Copying and pasting text to or from the clipboard is also supported via the DOS APIs in DOSBox-X, so DOS programs that can directly access the Windows 3.x/9x clipboard from a DOS window can also be used to copy and paste text to or from the shared clipboard when running in DOSBox-X. This function is disabled by default as of DOSBox-X 2024-07-01, but can be enabled either by checking the option "Enable DOS clipboard API for applications" within the "Shared clipboard functions" menu group, or by setting the config option dos clipboard api to true in the [dos] section of the config file.

When DOS clipboard APIs are activated, the WCLIP tool by Horst Schaeffer for example can be used to access the shared clipboard inside DOSBox-X. Below are some examples of using this program to communicate with the clipboard:

DIR | WCLIP

Will redirect the directory listing to the clipboard;

WCLIP /A < TEST.TXT

Will append the TEST.TXT file content to the clipboard;

WCLIP RECEIVE

Will display the content of the clipboard.

There are other similar DOS programs that will work in DOSBox-X, such as DOSClip 3.2, a TSR program to select, copy or paste text to or from the clipboard.

Like copying and pasting text using a DOS device, this bidirectional clipboard access will be deactivated if the secure mode for DOSBox-X is enabled, and it will also not work if booting into a guest OS.