A simple yet powerful Windows Batch Script designed to simplify connecting and launching of scrcpy; the powerful Android screen mirroring tool. This manager improves ease of usage for auto connection handling, multiple IP management, and extensive troubleshooting capabilities. Will PR to contribute with original project when it has matured here a little more.
- Multiple IP Storage: Save and manage multiple device IP addresses
- Automatic Connection: Attempts all saved IPs automatically on startup
- Smart Prioritization: Most recently used/successful IPs are tried first
- Skip Auto-Connect: Optional manual control over connection attempts
- Three Connection Modes:
- Saved Wi-Fi IP: Connect using stored IP addresses
- USB Cable: Direct connection via USB (scrcpy -d)
- New IP Setup: Add and immediately connect to new devices
- Multi-IP Support: Store unlimited device IP addresses
- Add/Remove IPs: Easy management interface with confirmation prompts
- Duplicate Detection: Prevents saving the same IP twice
- Auto-Reordering: Successfully connected IPs move to top priority
- IP Validation: Basic format checking before saving
- Automatic Troubleshooting:
- Direct connection attempt
- ADB server restart
- TCP/IP mode setup
- USB fallback option
- Tool Verification: Checks for ADB and scrcpy availability
- USB Device Detection: Validates device connection and authorization
- Network Diagnostics: Step-by-step guidance for connection issues
- Multiple Retry Options: Never get stuck - always have a way forward
- Welcome Screen: Clear program explanation on startup
- Intuitive Prompts: Plain language instead of cryptic codes
- Flexible Input: Accepts Y/N, Yes/No, or 1/0
- Session Management: Quick reconnect after disconnection
- Professional Formatting: Clean interface with section dividers
- Portable: Uses current directory - works from any location
- Startup Check: Looks for
lastip.txtwith saved IP addresses - Auto-Connect Option: Asks if you want to automatically try all saved IPs
- Connection Attempts: Tries each IP in order (most recent first)
- On Success: Launches scrcpy with optimized settings
- On Failure: Offers troubleshooting, manual selection, USB fallback, or new IP setup
- Session End: Provides quick reconnect options
- Direct Connection: Attempts
adb connect [IP]:5555immediately - ADB Restart: If failed, restarts ADB server and retries
- TCP/IP Setup: Falls back to
adb tcpip 5555with USB-connected device - USB Mode: Direct USB connection as final fallback
All connections use optimized settings:
--video-codec=h264: Hardware-accelerated encoding--max-size=1080: 1080p resolution for balance of quality and performance
- Windows OS (Batch Script)
- Android Debug Bridge (ADB) installed and in system PATH
- Download: Android SDK Platform Tools
- scrcpy installed and in system PATH
- Download: scrcpy releases
- Android Device with USB debugging enabled
-
Install Requirements:
- Install ADB (Android SDK Platform Tools)
- Install scrcpy
- Add both to your system PATH
-
Download Script:
- Save
scrcpy_manager.batto any folder - (Optional) Create desktop shortcut for quick access
- Save
-
First Run:
- Connect your Android device via USB
- Run the script
- Enable USB debugging on your device when prompted
- Follow on-screen instructions to set up Wi-Fi connection
-
Subsequent Runs:
- Script will automatically attempt saved IPs
- Or choose manual mode for more control
- 1 - Auto-try all saved IPs
- 2 - Select specific IP to connect
- 3 - Add new IP address
- 4 - Manage saved IPs (view/remove)
- 5 - Try USB connection
- 0 - Exit program
- 1 - Reconnect with same IP/USB
- 2 - Try all saved IPs again / Try wireless
- 3 - Select different saved IP
- 4 - Add new IP address (wireless only)
- 0 - Exit program
- Press 1 or Y at startup to auto-try all IPs
- Press 0 or N for manual control
- Selected IPs automatically move to top priority
- USB connection works as emergency fallback
lastip.txt: Stores all saved IP addresses (one per line, most recent first)temp_ips.txt: Temporary file used during IP reordering (auto-deleted)
Both files are created in the same directory as the script.
- Ensure Android SDK Platform Tools are installed
- Add ADB directory to Windows PATH environment variable
- Restart command prompt after PATH changes
- Download and extract scrcpy
- Add scrcpy directory to Windows PATH
- Verify by running
scrcpy --versionin command prompt
- Check USB cable (must support data transfer)
- Enable USB debugging in Developer Options
- Authorize computer on device when prompted
- Try different USB port
- Ensure device and computer on same Wi-Fi network
- Check if wireless debugging is enabled on device
- Verify IP address is correct (Settings β About Phone β Status)
- Try the built-in troubleshooting options (restarts ADB automatically)
- Check device screen for authorization prompt
- Accept "Allow USB debugging" dialog
- Check "Always allow from this computer" for convenience
- Add silent options.
- Close/Hide New Popup windows.
- Add connection flag/trigger.. title adjustment.
- Improve Menu and Controls.
- Make Gui or atleast add colors.
- Enhanced User Menu Prefrences.
- Selected IP moves to top of list - "Most Recently Used" ordering
- When user manually selects an IP, it moves to position #1
- Successfully connected IPs automatically move to top
- New IPs added at top of list (highest priority)
- Next auto-try prioritizes most recently used IPs first
- Added
:moveiptotopsubroutine for IP reordering - Improved duplicate IP handling - moves existing IP to top instead of error
- Option to skip automatic IP trying at startup
- Shows saved IPs and asks "Do you want to automatically try all saved IPs?"
- If declined, shows manual menu with full control options
- Better control flow with centralized manual menu
- Added dedicated manual menu for non-auto operations
- Reconnect after session ends with multiple options
- Quick reconnect with same IP immediately
- Try all saved IPs again option
- Select different saved IP manually
- Add new IP address
- Different reconnect menu for USB vs wireless connections
- IP Management Menu - view and remove saved IPs
- Select any IP by number to remove it
- Confirmation prompt before deletion
- Automatic redirect to add new IP if all IPs removed
- Option to retry all saved IPs after connection failure
Bug Fixes:
- Fixed: IP Management displaying "ipcount" instead of actual IPs - corrected variable expansion in display loop
- Multiple IP storage in
lastip.txt(one IP per line) - Automatically tries all saved IPs on startup
- Displays all saved IPs with numbering
- Manual IP selection from saved list
- Duplicate IP detection - won't save same IP twice
Bug Fixes:
- Fixed: Only first IP being read - changed from
set /pto properfor /floop - Fixed: IPs being overwritten - changed from
>(overwrite) to>>(append)
- Added case-insensitive input support
- Accepts: Yes, yes, Y, y, 1 for affirmative
- Accepts: No, no, N, n, 0 for negative
- More flexible user input throughout all prompts
Bug Fixes:
- Fixed: Complex regex IP validation causing false negatives - simplified to basic dot check
- Fixed: Delayed expansion issues with IP validation
- Enhanced all prompts for better user experience
- Added welcome screen with program explanation
- Changed cryptic prompts to plain language
- Improved error messages with context and actionable steps
- Added connection method explainer at startup
- Professional formatting with clear section dividers
- Changed all file paths to use current working directory (
%~dp0) - Files now stored relative to script location instead of hardcoded paths
- Portable - works from any location
- Added comprehensive error handling throughout the script
- IP format validation (checks for dots)
- Tool availability checks (verifies ADB and scrcpy are in PATH)
- USB device detection with detailed error messages
- Network connection troubleshooting with step-by-step recovery options
- Directory creation checks
- Graceful exit instead of force-killing CMD
- Improved connection flow: attempts direct connection before running
adb tcpip 5555 - Restarts ADB server automatically if initial connection fails
- Falls back to TCP/IP mode setup only after other methods fail
- Added "Retry same IP" option in all error menus
- Checks for last IP in
lastip.txt - Prompts for new IP if file is missing/empty
- Uses fixed 1080p resolution (
--max-size=1080,--video-codec=h264) - Saves IP when using 'newip' option
- Added
adb tcpipandadb connectcommands - USB mode uses
-dflag
Bug Fixes:
- Fixed: Title never changed to "Connected" - now uses
start /waitwith proper error level checking
- The script maintains IP order based on successful connections
- Most recently used IPs are tried first for faster connections
- All prompts accept multiple input formats (1/0, Y/N, Yes/No)
- The script never gets stuck - there's always an option to proceed
- USB mode works even if all wireless connections fail
This project is still maturing. Contributions, suggestions, and bug reports are welcome!
Free to use and modify. If you improve it, consider sharing your enhancements!