Skip to content

makarasty/win-cli-linker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Win CLI Linker

A lightweight PowerShell script to manage portable CLI tools on Windows without cluttering your System PATH variable.

⚠️ The Problem

If you use many portable tools (like ffmpeg, ngrok, aria2, scrcpy), you typically have two bad options:

  1. Cluttering PATH: Adding 10+ different folders to your System Environment Variables.
  2. Duplicating files: Copying all .exe files into a single C:\bin folder (which breaks updates and dll dependencies).

✅ The Solution

Win CLI Linker allows you to keep your tools organized in their original folders (e.g., on a secondary drive D:\Tools\...).

It automatically generates small .bat shims (wrappers) in a single directory (e.g., C:\P). You only need to add this one directory to your PATH.

Features

  • Zero Dependencies: Just a single PowerShell script.
  • Clean PATH: Only one entry in your environment variables.
  • Argument Passing: Correctly passes all arguments (e.g., ffmpeg -i ...) to the target executable.
  • Environment Variables: Supports paths like %USERPROFILE%\Downloads\....

Installation & Usage

1. Setup the Directory

  1. Choose a folder for your shims (Default is C:\P).
  2. Add this folder to your Windows PATH environment variable.
    • Search "Edit the system environment variables" -> "Environment Variables" -> Select "Path" -> "Edit" -> "New" -> Add C:\P.

2. Configure the Script

Open update-shims.ps1 and edit the configuration section. Add your tools to the $Tools list:

$ShimDir = "C:\P"

$Tools = @{
    # "CommandName"  = "Path\To\Original\Executable.exe"
    "ngrok"          = "D:\tools\ngrok.exe"
    "ffmpeg"         = "D:\tools\ffmpeg\bin\ffmpeg.exe"
    "ffprobe"        = "D:\tools\ffmpeg\bin\ffprobe.exe"
    "my-tool"        = "%USERPROFILE%\Downloads\tool.exe"
}

3. Run

Double-click update-shims.ps1. It will create (or update) the .bat files in your shim directory.

[OK]  ngrok
[OK]  ffmpeg
[OK]  ffprobe
Done. Press Enter to exit...

Now you can open any terminal (CMD, PowerShell, Git Bash) and type ffmpeg or ngrok from anywhere.

License

MIT License. Feel free to use and modify.

About

Simple CLI tool manager for Windows. Uses batch shims to link executables from various locations to a single directory in PATH

Topics

Resources

License

Stars

Watchers

Forks

Contributors