Skip to content

binave/xcmd

Repository files navigation

eXternal Command

eXternal Command - command-line wrapper for batch and shell

License Version

A collection of commonly used batch and shell functions.

简体中文


📖 Table of Contents


✨ Features

  • xlib/xlib.cmd - Uses only first-party tools, works out of the box with dozens of practical commands
  • x3rd/x3rd.cmd - Wraps third-party command-line tools
  • Support for Windows, macOS, and Linux
  • Built-in error handling and help system
  • Support for UNC paths (Windows SMB)
  • Easy to deploy

📦 Installation

For Windows

  1. Download xlib.cmd and/or x3rd.cmd
  2. Add the script directory to your PATH environment variable
  3. Ensure the script uses CRLF line endings
  4. Avoid using non-ANSI characters in the script

For macOS/Linux

  1. Download xlib and/or x3rd
  2. Add execute permission: chmod +x xlib
  3. Add the script directory to your PATH
  4. Ensure the script uses LF line endings

Quick Test

# Show help
xlib -h
xlib --help

# Show command help
xlib <command> -h
xlib <command> --help

# Show version
xlib version

  • Use -h or --help to get usage help for any command
  • Use -h or --help after a command to get detailed help for that specific command

💡 Examples

Wake on LAN

Wake up a computer on the same network:

# aa:bb:cc:dd:ee:ff is the target NIC MAC address
xlib wol aa:bb:cc:dd:ee:ff

BitLocker Encryption (Windows)

Encrypt all disks on a computer without TPM support:

:: Prepare a FAT32 USB device for storing startup keys
xlib vol --encrypts-all

:: Run from UNC path (SMB server)
\\192.168.1.1\xcmd\xlib vol --encrypts-all

:: Hide encryption indicators and BitLocker menu
xlib vol --hide-bitlocker

:: For more details
xlib vol --help

Capture AppStore PKG Files (macOS)

Capture original PKG installation packages from AppStore:

xlib pkg -g 5

Then open AppStore and download apps. PKG files will appear in the Downloads folder.

Network Host Discovery

Search and access computers with dynamic IPs using fixed names:

  1. Create .host.ini in %USERPROFILE% or $HOME:
[hosts]
; Single MAC address, ignored if not matched
gl.inet=00:11:00:00:00:00

; Match from left, fallback to 127.0.0.1 if no match
syno-15=00-11-00-00-11-00|11:00:00:00:00:11|00-11-00-00-00-11|127.0.0.1

; Direct IPv4 address
binave.com=127.0.0.1

[sip_setting]
; IPv4 search range
range=1-120
  1. Run the command (requires admin privileges):
xlib hosts

Microsoft Office Deployment

Automated Microsoft Office Installation

:: help info
xlib odt -h

:: Download the latest Office installation files first
xlib odt -d \\192.168.1.1\xcmd 2024
xlib odt -d D:\ 2021

:: Automatically install specified components
\\192.168.1.1\xcmd\xlib odt -i word excel powerpoint 2024

KMS Activation

Automatically activate Windows and Office using KMS service:

:: Using KMS service activate Windows
xlib kms -s 192.168.1.1

:: Using KMS service activate Office
xlib kms -o 192.168.1.1

:: Using KMS service activate Windows and Office
\\192.168.1.1\xcmd\xlib kms -a

Clipboard File Transfer

Transfer small files/folders via RDP clipboard (for older Windows versions):

  1. Download clipTransfer.vbs on both local and remote machines
  2. Drag files/folders onto the VBS script on one end
  3. Wait for completion
  4. Double-click the VBS script on the other end to receive

🔧 Features Detail

xlib.cmd (Windows)

  • Supports use in for /f commands (use call for conditional operations)
  • Function name auto-completion (matches characters from left to right)
  • Multi-process control support (e.g., hosts function)
  • Virtual disk control, WIM file manipulation, string operations, hash calculation
  • VBS script integration via xlib vbs command for downloads and transcoding

xlib / bash.xlib (macOS/Linux)

  • Shell implementation of complex data structures (dictionaries, queues, etc.)
  • Platform-specific functions for macOS and Linux

📄 License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for the full license text.

About

command-line wrapper for batch and shell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published