cmd-matrix is a Windows utility that reads commands from a text file and executes them in multiple CMD windows arranged in a grid layout.
- π File-Driven: Reads commands from text files, one command per line
- πͺ Grid Layout: Automatically arranges CMD windows in a neat grid
- β‘ Parallel Execution: All windows execute their commands simultaneously
- π Comment Support: Supports adding comments in command files (line-starting # only)
- π― Smart Layout: Automatically calculates optimal grid size based on command count
- π§ Compatibility Mode: Retains original window movement functionality
Create a text file (e.g., commands.txt) with one command per line to be executed in CMD windows:
echo Welcome to cmd-matrix! This is Window 1
dir C:\ /w
ipconfig /all
echo Current system info: && systeminfo | findstr /B /C:"OS" /C:"System"
ping google.com -n 4
tasklist | findstr "chrome"cmd-matrix.exe --file commands.txtThe program will automatically create multiple CMD windows, each executing one line from the file.
Important Note: The program will wait for you to press Enter in the command line window before closing all created CMD windows. During this time, all windows remain open.
cmd-matrix.exe [options] [parameters]Execution Flow: The program first reads and displays all commands, then creates the specified number of CMD windows, each executing the corresponding command. After creation, the program waits for you to press Enter in the command line window, then closes all created windows.
cmd-matrix.exe --file <filename> [rows] [cols]--file: Specifies the text file containing commands[rows]: Optional, number of grid rows (auto-calculated by default)[cols]: Optional, number of grid columns (auto-calculated by default)
Examples:
# Use commands from file with auto-calculated layout
cmd-matrix.exe --file mycommands.txt
# Use commands from file with 2x3 grid
cmd-matrix.exe --file mycommands.txt 2 3cmd-matrix.exe --test [rows] [cols]--test: Creates test windows without using a file[rows]: Optional, number of grid rows (default 3)[cols]: Optional, number of grid columns (default 3)
Examples:
# Create 3x3 test windows
cmd-matrix.exe --test
# Create 2x4 test windows
cmd-matrix.exe --test 2 4cmd-matrix.exe --resolutionDisplays current screen resolution information.
cmd-matrix.exe "window_title" <x_coord> <y_coord> <width_chars> <height_chars>Moves a window with the specified title to the specified position and size. This is the compatibility mode for the original win_sizer functionality.
Example:
# Move window containing "CMD" to (100,100) with size 80x25 characters
cmd-matrix.exe "CMD" 100 100 80 25Note: This mode does not create new windows, it only moves existing windows.
- One command per line
- Commands execute in corresponding CMD windows
- Empty lines are ignored
Lines starting with # are treated as comments and will not be executed:
# This is a comment
echo Hello World # This is NOT a comment, # will be treated as part of the command
# System information query
echo System Information:
systeminfo | findstr /B /C:"OS"
# Network test
ping 8.8.8.8Important: According to the code implementation, only lines starting with # are recognized as comments and skipped. # symbols within commands are not specially processed and are treated as part of the command.
# System Information
echo ===== System Information ===== && systeminfo | findstr /B /C:"OS" /C:"System"
# Network Configuration
echo ===== Network Configuration ===== && ipconfig /all
# Disk Space
echo ===== Disk Space ===== && wmic logicaldisk get size,freespace,caption
# Process List
echo ===== Running Processes ===== && tasklist | findstr /V "Console"# Network Diagnostic Tools
# Test local network
echo Testing local gateway... && ping 192.168.1.1 -n 4
# Test DNS
echo Testing DNS server... && nslookup google.com
# Test internet connection
echo Testing internet connection... && ping google.com -n 4
# Display routing table
echo Displaying routing table... && route print
# Display network connections
echo Displaying network connections... && netstat -an# Development Environment Check
echo Node.js Version: && node --version
echo npm Version: && npm --version
echo Python Version: && python --version
echo Git Version: && git --version
echo Docker Status: && docker --versionIf rows and columns are not specified, the program automatically selects the optimal layout based on command count:
- 1-4 commands: 2Γ2 grid
- 5-6 commands: 2Γ3 grid
- 7-9 commands: 3Γ3 grid
- 10-12 commands: 3Γ4 grid
Note: The actual number of windows created is the smaller of command count and grid size. For example, if you have 5 commands but specify a 2Γ2 grid, only 4 windows will be created.
You can save command output to files:
ipconfig /all > network_info.txt
dir C:\ > file_list.txtYou can combine multiple commands in one line using && or |:
echo Starting check && systeminfo && echo Check complete
dir C:\ | findstr "Directory"- All windows open simultaneously and arrange on screen
- Press Enter to close all windows (in the main program window)
- Window title format:
BATCH-CMD-X-WIN(X is window number)
A: ANSI encoding or UTF-8 encoding (without BOM) is recommended.
A: Check if the command syntax is correct. You can test commands in a separate CMD window first.
A: You need to run cmd-matrix.exe as administrator.
A: Check screen resolution to ensure there's enough space for all windows.
A: Press Enter in the command line window where cmd-matrix is running to close all created CMD windows.
- Command Length Limit: Maximum 1024 characters per command
- Command Count Limit: Maximum 100 commands
- Window Count: Maximum 100 windows
- File Path: Use full path if command file is not in the same directory
- Special Characters: Use quotes when file path contains spaces
- Comment Rule: Only lines starting with
#are recognized as comments,#in commands is treated as part of the command - Closing Method: You can only close all windows by pressing Enter in the command line window where cmd-matrix is running, not in the created CMD windows
- Usage of AI: Most of the above content generated by AI.