Web banner featuring the bridge from Monet's Water Lilies with the text 'My virtual desk' written on it

Desktop Scripts

A collection of free Windows .bat scripts I've built up for repetitive media tasks — convert iPhone HDR footage to normal video, batch convert images to WebP, remove backgrounds with AI, strip EXIF metadata, unlock password-protected PDFs, compress video to a target size, and more. Run the setup once, drop files onto a script, done. No terminal, no subscription.

Prerequisites

Quick Start

  1. Download & extract the ZIP
  2. Double-click _setup.bat and pick your tools
  3. Drag & drop files onto a script

Setup installs only what your chosen tools need, using winget, and skips anything already installed. Run it again any time to change your picks.

Audio & Video

iPhone HDR to Normal Video

hdr-to-sdr.bat Needs: FFmpeg

Converts iPhone HDR video to a normal, standard video file that looks correct on every screen and imports cleanly into any video editor. Output is a ProRes 422 HQ .mov file.

e.g. Batch-convert a folder of iPhone clips before dropping them into Premiere, DaVinci Resolve, or iMovie.
Note: The source must be tagged as HDR (HLG or PQ); plain SDR video will fail.
Logic: iPhones record in HDR by default, which can look washed out or blown out on standard screens and in most editors. This script tone-maps the footage with FFmpeg's Hable algorithm to bring brightness and colour into the normal range everyone expects. Only the main video and audio tracks are kept, so stray subtitle or data tracks can't break the export. Output is a 10-bit ProRes .mov with the _sdr suffix.

Concatenate Audio

concat-audio.bat Needs: FFmpeg

Joins multiple audio files into a single 192 kbps MP3, even when they're in different formats or sample rates.

e.g. Merge three interview segments into one final episode.
Logic: Each dropped file is first converted to a common WAV, so mixed formats, sample rates, and files with album art join cleanly. The WAVs are then joined with FFmpeg's concat demuxer and encoded to MP3 at 192 kbps. Output is concatenated_<timestamp>.mp3 next to the first file.

Convert to MP3

to-mp3.bat Needs: FFmpeg

Extracts the audio from any audio or video file as high-quality MP3 (VBR ~190 kbps). Skips files already in MP3 format.

e.g. Convert video lectures to MP3 for audio-only playback.
Logic: Checks extension; skips if already .mp3. Maps the first audio track and runs FFmpeg with -q:a 2 (VBR quality level 2, ~190 kbps).

Convert to MP4

to-mp4.bat Needs: FFmpeg

Re-encodes video to H.264 MP4 at high quality with web-optimised faststart. Keeps every audio track. Skips existing MP4s.

e.g. Convert a ProRes export or MKV into a shareable, web-streamable MP4.
Logic: Uses libx264 at CRF 18 (visually lossless quality) in yuv420p, so 10-bit sources play everywhere. Odd dimensions are rounded to even, and subtitle and data tracks that MP4 can't hold are dropped. Audio is AAC at 192 kbps. Faststart moves metadata to the front so the video can start playing before it finishes downloading.

Compress Video

vid-compress.bat Needs: FFmpeg

Compresses video to fit under ~60 MB, capping resolution at 1080p. Saves as *_small.mp4.

e.g. Shrink a 400 MB screen recording to under 60 MB for email.
Logic: Tries a single CRF 23 encode first. If that's still over 60 MB, it calculates the exact bitrate from the video's length and does a 2-pass encode that lands under the limit. Resolution is capped at 1080p on the short side, and temp files are always cleaned up.

Video to GIF

vid-to-gif.bat Needs: FFmpeg

Converts a short video clip to an optimised animated GIF at 15 fps and max 640 px wide. Small videos are never upscaled.

e.g. Turn a 10-second UI interaction into a GIF for a README.
Logic: Two-pass encoding: first pass analyses the video and builds an optimal colour palette; second pass uses that palette to produce a clean, low-banding GIF. Dropped .gif files are skipped.

Image Conversion

Convert to JPG

to-jpg.bat Needs: ImageMagick

Converts any image to JPG at 100% quality, stripping metadata. Skips existing JPGs.

e.g. Convert a batch of PNG design exports to JPG for web.
Logic: Calls ImageMagick with -quality 100 and -strip. Photos are rotated upright before the orientation data is removed, and transparent areas are flattened onto white instead of turning black.

Convert to PNG

to-png.bat Needs: ImageMagick

Converts any image to lossless PNG with transparency support. Skips existing PNGs.

e.g. Convert JPG screenshots to PNG for documentation.
Logic: Passes source through ImageMagick's PNG encoder with default lossless compression. Animated or multi-page input gives one PNG from the first frame.

Convert to WebP

to-webp.bat Needs: FFmpeg

Converts images to WebP at 90% quality for excellent web compression. Skips existing WebPs.

e.g. Convert product photos to WebP before deployment.
Logic: Uses FFmpeg's libwebp encoder with -quality 90, taking only the first frame of animated input.

Convert to Small WebP

to-webp-sm.bat Needs: FFmpeg

Converts images to WebP and scales down to a max of 700 px wide. Smaller images are not enlarged. Adds a -sm suffix.

e.g. Batch-resize and convert photos to WebP thumbnails.
Logic: Caps width at 700 px while preserving aspect ratio; images already narrower than that keep their size.

Resize to 64×64

to-64x64.bat Needs: FFmpeg

Resizes any image to exactly 64×64 pixels as an RGBA PNG. Adds a _64x64 suffix.

e.g. Batch-convert illustrations to 64×64 PNG sprites.
Logic: Uses scale=64:64 with nearest-neighbour algorithm for pixel-perfect results.

Convert to Black & White

to-bw.bat Needs: ImageMagick

Desaturates images to greyscale while keeping the original file format, including animated GIFs. Adds a -bw suffix.

e.g. Convert a set of portrait photos to B&W for a layout.
Logic: Applies ImageMagick's -colorspace Gray conversion and keeps every frame. Double-click it without dropping anything to pick files from a dialog.

Image Enhancement

Optimise for Web

img-optim.bat Needs: ImageMagick

Resizes images to max 1920 px tall and saves them as JPG under 200 KB in a resized/ folder.

e.g. Prepare high-res photos for Webflow or WordPress.
Logic: Uses ImageMagick's jpeg:extent=200KB to find the highest quality that fits in one pass. Warns you with the final size if an image can't get under it. Each resized/ folder sits next to its own source file.

Strip EXIF

img-strip.bat Needs: ImageMagick (ExifTool optional)

Strips all metadata (GPS, device info, timestamps) and renames the file to a random 12-character string.

e.g. Anonymise photos before posting to a public forum.
Logic: ImageMagick rotates the photo upright, strips metadata, and re-saves at quality 82 (max 2048 px). If ExifTool is installed, it does an extra metadata pass. The original is kept.

4K Blurred Background

img-4k-bg.bat Needs: ImageMagick

Creates a 3840×2160 (4K landscape) image with the original centred on a blurred, darkened copy of itself.

e.g. Turn a portrait phone photo into a 4K desktop wallpaper with a blurred backdrop.
Logic: Fills 3840×2160 with the image, blurs and darkens it, then overlays the original centred on top. Saves as *-4k-landscape.jpg.

Trim PNG Whitespace

trim-png.bat Needs: ImageMagick

Removes uniform borders or transparent padding from PNG files. Adds a -trimmed suffix.

e.g. Remove transparent padding around exported Figma icons.
Logic: Runs -trim to detect and remove borders, then +repage to reset canvas.

Generate Favicon

to-favicon.bat Needs: ImageMagick

Generates a 64×64 pixel .ico favicon from any image, padded to square.

e.g. Turn a high-resolution logo PNG into a browser favicon.
Logic: Resizes to fit within 64×64 on a transparent canvas and saves as ICO in a favicons/ subfolder.

AI Tools

Remove Background

remove-bg.bat Needs: Python + transparent-background

Removes image backgrounds using an AI segmentation model (InSPyReNet). Outputs transparent PNG.

e.g. Cut product photos from their backgrounds for a white backdrop.
Note: The setup script installs PyTorch, a 2–3 GB download. The model downloads on first use.
Logic: Calls transparent-background with --type rgba and saves the results to removed-bg/. It uses transparent-background from your PATH; set VENV at the top of the script to use a virtual environment instead.

Documents

Convert to Markdown

to-md.bat Needs: Pandoc

Converts Word docs, HTML, EPUB, slides, spreadsheets, notebooks, and more to clean Markdown.

e.g. Convert a Word doc brief into Markdown for a static site.
Note: Pandoc can't read legacy .doc or .pdf files. Save .doc as .docx first.
Logic: Runs Pandoc with --wrap=none and tells it each file's input format explicitly. Reads .docx, .odt, .epub, .html, .rtf, .tex, .rst, .pptx, .xlsx, .ipynb, .org, .typ, and more. Output goes to markdown_output/.

Unlock PDF

pdf-unlock.bat Needs: qpdf

Removes the password from PDFs, leaving everything else in the file exactly as it was. Saves as *-unlocked.pdf.

e.g. Unlock a monthly bank statement so it opens without a prompt.
Note: A digitally signed PDF will show its signature as invalid after unlocking.
Logic: Asks for the password with hidden input (3 tries, Enter to skip). PDFs that open without a password but block printing or editing are unlocked without asking. Nothing is re-rendered or recompressed, the file's dates are kept, and the password never appears on a command line.

Compression

Folder to ZIP

dir-to-zip.bat Needs: Windows

Compresses each dropped folder to a ZIP archive. Includes hidden files and handles files over 2 GB.

e.g. Zip a project folder before uploading to cloud storage.
Logic: Uses .NET's built-in ZipFile through PowerShell. Skips folders whose ZIP already exists, and deletes a half-written ZIP if something fails.

Folder to 7Z

dir-to-7z.bat Needs: 7-Zip

Compresses folders to 7Z format with medium compression.

e.g. Archive large asset folders for long-term storage.
Logic: Runs 7-Zip with -mx=5, found in its default install folder or on PATH. Warns you if locked files were skipped, and deletes a half-written archive on failure.

File Utilities

Find Duplicate Files

file-dedup.bat Needs: Windows

Finds exact duplicates among dropped files and folders by SHA-256 hash, and reports how much space you'd get back.

e.g. Drop your Pictures folder to find photos saved under different names.
Logic: Searches folders recursively with built-in PowerShell. Only files that share a size are hashed, so large folders are fast; empty files are ignored. Groups are listed largest first. Nothing is deleted.

Network & System

Flush DNS Cache

flush-dns.bat Needs: Windows

Clears the Windows DNS resolver cache. Needs admin, and asks for it itself.

e.g. Force Windows to pick up new DNS records immediately.
Logic: Shows the UAC prompt if it isn't already running as admin, then executes ipconfig /flushdns.

Restart WinNAT

restart-winnat.bat Needs: Windows

Stops and restarts the Windows NAT service. Needs admin, and asks for it itself.

e.g. Fix WSL2 networking after a 'port already in use' error.
Logic: Shows the UAC prompt if it isn't already running as admin, then runs 'net stop winnat' and 'net start winnat'.