flip
is a Windows command-line tool that copies files to the clipboard. The name is derived from the Windows tool clip
, which copies text to the clipboard.
-
Print usage
$> flip --help USAGE: flip [OPTION]... FILE... A Windows command-line tool to copy files to the clipboard. OPTIONS: -h, --help Print the usage and exit -v, --verbose Print verbose logs
-
Copy multiple files to the clipboard
$> flip .\test C:\Users\Lotkey\Desktop\awesome_file.png
-
Copy a file to the clipboard with verbose logging
$> flip -v C:\Users\Lotkey\Desktop\awesome_file.png Copying files: [C:\Users\Lotkey\Desktop\awesome_file.png] Filename list: [C, :, \, U, s, e, r, s, \, L, o, t, k, e, y, \, D, e, s, k, t, o, p, \, a, w, e, s, o, m, e, _, f, i, l, e, ., p, n, g, , ] dropfiles: {pFiles: 20, pt: {x: 0, y: 0}, fNC: 0, fWide: 0}
- Download a prebuilt executable from the Releases page.
- Move the executable. If you're not sure where to put it,
C:\Program Files\flip\bin
is the default chosen bycmake
. - Add the path to the executable to the
PATH
environment variable.
Requirements:
cmake
- A C++17 compiler
If neither of these are installed you can visit this link to download the Visual Studio Build Tools. This includes the Microsoft C++ compiler and cmake
. Run any build or install steps from the newly installed Developer Command Prompt for VS. Running install steps will require administrator privileges.
If git
is installed:
$> git clone https://github.com/lotkey/flip.git
Otherwise, manually download and unzip the zipped repository.
After cloning the repository, navigate into the root of the repository:
$> cd flip
Create and navigate into a build directory:
$> mkdir build
$> cd build
To configure a 64-bit executable, run:
$> cmake .. -A x64
To configure a 32-bit executable, run:
$> cmake .. -A Win32
In the output from the cmake
command there will be a line similar to:
Add ... to your PATH variable.
The output will show the install directory for flip
instead of ...
. Make note of this directory for the install step.
To build the executable for release, run:
$> cmake --build . --config Release
To install the executable, run:
$> cmake --install .
Add the directory from the cmake
output in the configure step to your PATH
environment variable to make flip
executable from anywhere within cmd
or powershell
.
The Windows clipboard supports data in many formats. For example, the CF_TEXT
format is used for copying plain text to the clipboard.
The CF_HDROP
format is used for copying files to the clipboard in drag-and-drop operations. The HDROP
structure is written to the clipboard and the receiving application is responsible for parsing it.
Along with the HDROP
structure, a list of paths of the files to copy is written to the clipboard. The paths are written as a contiguous, null-terminated array of null-terminated C-strings. This list of paths is written directly after the HDROP
structure in memory.
In order to copy files C:\picture.png
and C:\text.txt
, the following structure is written to the clipboard:
Type | Data | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DROPFILES |
|
||||||||||||||||||||||||||||
char * |
|