Menu

Using the Microsoft Windows Subsystem for Linux (WSL)

I am using both Windows and Linux for my projects for various reasons. What I like about Linux is the broad availability of command line tools to manipulate documents and media.

Most of these tools are also available natively for Windows, but to install and integrate them is usually more involved. Also there seems to be no standard way to maintain and update these tools under Windows.

Furthermore, these tools usually make use of libraries. Under Windows, each tool comes with its own set of libraries, because the tool installer has no knowledge of other tools, which might use the same libraries.

The following are examples of tools I use under the Windows Subsystem for Linux (WSL):

Examples of Drag and Drop operations

While I value the power of the Linux command line tools, I am still a long standing Windows and mouse user and want to use drag and drop on the Windows desktop. This can be achieved using the interoperability between Linux and Windows provided by WSL.

I usually write a Windows cmd script to use as a drag-and-drop target. Some things might also be able to do with just a desktop short-cut.

Below are some example scripts I use. Use the scripts at our own risk. I do not take any responsibility.

The WSL command wslpath is used to convert from Windows paths to Linux paths. The quotes are necessary to allow for spaces in the paths and files names.

Show EXIF information

@ECHO OFF

bash -c "exiftool -all '`wslpath '%~1'`' | less"

List All Images In a PDF File

@ECHO OFF

REM Just list
bash -c "pdfimages -list '`wslpath '%~1'`' | less"

Extract All Images From a PDF File

@ECHO OFF

REM Extract keeping each indiv. format
REM -p includes page number in output file name
REM Nota bene: pdfimages does not output anything to stdout!
bash -c "pdfimages -p -all '`wslpath '%~1'`' myIMG" 

REM Extract forcing TIFF
REM bash -c "pdfimages -p -tiff '`wslpath '%~1'`' myIMG"

Last change: 2021-12-10
© 2002-2024 Dr. Thomas Redelberger redetho(a‍t)gmx.de

Close menu