Blinter is a linter for Windows batch files (.bat and .cmd). It provides comprehensive static analysis to identify syntax errors, security vulnerabilities, performance issues and style problems. Blinter helps you write safer, more reliable and maintainable batch scripts. Even in 2025, batch files deserve professional tooling! 💻
- ✅ Configurable Options - Configurable rules, logging, robust error handling
- ✅ Unicode Support - Support for international characters and filenames
- ✅ Performance Optimized - Handles large files (10MB+) efficiently
- 157 Built-in Rules across 5 severity levels
- Error Level (E001-E999): Critical syntax errors that prevent execution
- Warning Level (W001-W999): Potential runtime issues and bad practices
- Style Level (S001-S999): Code formatting and readability improvements
- Security Level (SEC001+): Security vulnerabilities and dangerous operations
- Performance Level (P001-P999): Optimization opportunities and efficiency improvements
📖 For complete rule descriptions with examples and implementation details, see Batch-File-Linter-Requirements.md
- Rule Codes: Each issue has a unique identifier (e.g., E002, W005, SEC003)
- Clear Explanations: Detailed descriptions of why each issue matters
- Actionable Recommendations: Specific guidance on how to fix problems
- Line-by-Line Analysis: Precise location of every issue
- Context Information: Additional details about detected problems
- Static Code Analysis: Detects unreachable code and logic errors
- Advanced Variable Expansion: Validates percent-tilde syntax (%~n1), string operations, and SET /A arithmetic
- Command-Specific Validation: FOR loop variations, IF statement best practices, deprecated command detection
- Variable Tracking: Identifies undefined variables and unsafe usage patterns
- Security Scanning: Path traversal attacks, command injection risks, unsafe temp file creation
- Performance Optimization: DIR flag optimization, unnecessary output detection, string operation efficiency
- Cross-Platform Compatibility: Warns about Windows version issues and deprecated commands
- Large File Handling: Efficiently processes files up to 10MB+ with performance warnings
- Robust Encoding Detection: Handles UTF-8, UTF-16, Latin-1 and 6 more encoding formats
- Advanced Escaping Techniques: Validates caret escape sequences, multilevel escaping, and continuation characters
- Professional FOR Command Analysis: Checks for usebackq, proper tokenizing, delimiters, and skip options
- Process Management Best Practices: Timeout command usage, process verification, and restart patterns
- Enhanced Security Patterns: User input validation, temporary file security, and self-modification detection
Option 1: Install via pip
Option 2: Download standalone executable
- Download the latest Blinter-v1.0.x-windows.zip from GitHub Releases
- Clone the repository:
- (Optional) Create a virtual environment:
- (Optional but recommended) Install dependencies:
- Python 3.9+ (required for pip installation and development)
- Windows OS (required for standalone executable)
If installed via pip:
If using standalone executable:
If using manual installation:
- <path>: Path to a batch file (.bat or .cmd) OR directory containing batch files
- --summary: Display summary statistics of issues found
- --severity: Show detailed severity level breakdown (always included)
- --no-recursive: When processing directories, only analyze files in the specified directory (not subdirectories)
- --no-config: Don't use configuration file (blinter.ini) even if it exists
- --create-config: Create a default blinter.ini configuration file and exit
- --help: Show help menu and rule categories
Note: Command line options override configuration file settings. Blinter automatically looks for blinter.ini in the current directory.
[general] | recursive | Search subdirectories when analyzing folders | true |
[general] | show_summary | Display summary statistics after analysis | false |
[general] | max_line_length | Maximum line length for S011 rule | 120 |
[general] | min_severity | Minimum severity level to report | None (all) |
[rules] | enabled_rules | Comma-separated list of rules to enable exclusively | None (all enabled) |
[rules] | disabled_rules | Comma-separated list of rules to disable | None |
Command line options always override configuration file settings:
You can suppress specific linter warnings directly in your batch files using special comments:
Supported formats:
- REM LINT:IGNORE <code> - Suppress specific rule(s) on the next line
- REM LINT:IGNORE - Suppress all rules on the next line
- REM LINT:IGNORE-LINE <code> - Suppress specific rule(s) on the same line
- REM LINT:IGNORE-LINE - Suppress all rules on the same line
- :: LINT:IGNORE <code> - Alternative comment syntax (also supported)
Use cases:
- Suppress false positives that can't be fixed
- Ignore intentional deviations from best practices
- Handle edge cases in documentation or help text
- Temporarily ignore issues during development
Blinter provides a powerful Python API for integration into your applications:
file_path | str | Required | Path to batch file to analyze |
max_line_length | int | 120 | Maximum line length for S011 rule |
enable_style_rules | bool | True | Enable/disable style-related rules |
enable_performance_rules | bool | True | Enable/disable performance rules |
Note: Security rules are always enabled for safety.
- .bat files (traditional batch files)
- .cmd files (recommended for modern Windows)
- Unicode filenames and international characters supported
- Large files (10MB+) handled efficiently with performance monitoring
Blinter can analyze entire directories of batch files with powerful options:
- Recursive Analysis: Automatically finds and processes all .bat and .cmd files in directories and subdirectories
- Non-Recursive Mode: Use --no-recursive to analyze only files in the specified directory
- Batch Processing: Handles multiple files efficiently with consolidated reporting
- Error Resilience: Continues processing other files even if some files have encoding or permission issues
- Progress Tracking: Shows detailed results for each file plus combined summary statistics
Examples:
Contributions are welcome!
- 🐛 Report bugs or issues
- 💡 Suggest new rules or features
- 📖 Improve documentation
- 🧪 Add test cases
- 🔧 Submit bug fixes or enhancements
This project is licensed under the CRL License - see LICENSE.md for details.