install.bat - Technical Documentation
Overview
install.bat is a Windows batch script designed to automate the installation of the Skyblock by Asma mod into the Hytale saves directory. It provides a user-friendly interface with color-coded output and supports both automated and manual folder detection.
Features
- Automatic folder detection: Searches for folders matching the pattern
Skyblock_by_Asma_v* - Custom folder support: Accepts a folder name as a command-line argument
- Dry-run mode: Preview installation without making changes
- Color-coded output: ANSI color codes for better readability
- Overwrite protection: Prompts user before overwriting existing installations
- Version extraction: Automatically extracts version from folder name or uses folder name as fallback
Command-Line Arguments
Syntax
install.bat [FolderName] [/dry-run | /d | --dry-run] [/? | /help | --help]
Arguments
| Argument | Description | Example |
|---|---|---|
FolderName |
Optional. Name of the folder to install. If not provided, searches for Skyblock_by_Asma_v* pattern. |
install.bat "MyCustomFolder" |
/dry-run |
Optional. Run in dry-run mode (no changes will be made). | install.bat /dry-run |
/d |
Short form of /dry-run |
install.bat /d |
--dry-run |
Alternative form of /dry-run |
install.bat --dry-run |
/?, /help, --help |
Display help information | install.bat /? |
Examples
# Default behavior - auto-detect folder
install.bat
# Specify custom folder name
install.bat "MyCustomFolder"
# Dry-run with default folder
install.bat /dry-run
# Dry-run with custom folder
install.bat "MyCustomFolder" /dry-run
# Display help
install.bat /help
Technical Implementation
Color System
The script uses ANSI escape codes for color output. Colors are defined at the start:
RED(31): Error messagesGREEN(32): Success messages and found itemsYELLOW(33): Warnings and cancellation messagesCYAN(36): Information, paths, and headersMAGENTA(35): Dry-run mode indicatorsBOLD(1): Emphasis on important textRESET(0): Reset to default color
ANSI support is enabled by extracting the escape character using echo prompt $E | cmd.
Folder Detection Logic
-
Custom Folder Name (if provided):
- Validates that the folder exists in the script's directory
- Checks that it's actually a folder (not a file)
- Uses the provided path directly
-
Default Pattern (if no folder name provided):
- Searches for folders matching
Skyblock_by_Asma_v*pattern - Uses the first matching folder found
- Exits with error if no match is found
- Searches for folders matching
Version Extraction
The script attempts to extract version information from the folder name:
- Pattern Match: If folder name matches
Skyblock_by_Asma_v*, extracts everything afterSkyblock_by_Asma_vas the version - Fallback: If pattern doesn't match, uses the entire folder name as the version identifier
Example:
- Folder:
Skyblock_by_Asma_v1.0.4→ Version:1.0.4 - Folder:
MyCustomFolder→ Version:MyCustomFolder
Destination Path Construction
The destination path is constructed as:
%APPDATA%\Hytale\UserData\Saves\Skyblock_by_Asma_v{VERSION}
Where {VERSION} is the extracted version or folder name.
Installation Process
-
Validation:
- Verifies source folder exists
- Checks if destination directory structure exists (creates if needed)
-
Overwrite Check:
- If destination folder exists, prompts user for confirmation
- User can choose to overwrite (Y) or cancel (N)
-
File Operations (only in non-dry-run mode):
- Removes existing installation if overwrite confirmed
- Creates destination directory structure if needed
- Copies all files using
xcopy /E /I /Y(recursive, assume destination is directory, suppress prompts)
-
Error Handling:
- Validates folder existence before proceeding
- Checks file operation success
- Provides clear error messages with troubleshooting tips
Dry-Run Mode
When dry-run mode is enabled:
- All file operations are skipped
- Output is prefixed with
[DRY-RUN] - Shows what would happen without making changes
- Useful for testing and verification
Error Handling
The script handles several error conditions:
- Folder Not Found: Exits with error code 1, displays helpful message
- Invalid Folder: If path exists but isn't a folder, exits with error
- Copy Failure: Checks
xcopyexit code, displays troubleshooting tips - User Cancellation: Exits with code 0 (normal exit)
Exit Codes
0: Success or user cancellation1: Error (folder not found, copy failure, etc.)
Dependencies
- Windows: Designed for Windows batch scripting (cmd.exe)
- ANSI Support: Requires Windows 10/11 or terminal with ANSI support for colors
- xcopy: Uses built-in Windows
xcopycommand for file copying
Environment Variables
The script uses the following environment variables:
%APPDATA%: Windows application data directory (typicallyC:\Users\{Username}\AppData\Roaming)%~dp0: Script's directory path (automatically set by batch processor)%CD%: Current working directory
Limitations
- Windows Only: Designed specifically for Windows batch scripting
- ANSI Colors: Color output requires ANSI-capable terminal (Windows 10/11 default terminal)
- Single Folder: Only processes one folder at a time
- No Rollback: Does not provide rollback functionality if installation fails mid-process
Future Enhancements
Potential improvements:
- Support for multiple folder installations
- Backup creation before overwrite
- Installation log generation
- Support for custom destination paths
- Progress indicator for large file copies
See Also
INSTALL.en.md: User-friendly English installation guideINSTALL.it.md: User-friendly Italian installation guide
