Last active
September 3, 2024 00:27
-
-
Save Techlogist/89da985b44ecec71a943d86162bd0d6b to your computer and use it in GitHub Desktop.
Wake-On-LAN multiple computers at once!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM License: GNU General Public License v2.0 | |
REM Author: Miguel | |
REM Website: www.techlogist.net | |
REM Post: https://techlogist.net/batch/wake-on-lan-multiple-computers-at-once/ | |
REM Description: Wakes up the computers on LAN | |
REM OS/Language/Region: Windows/EN-US | |
REM Links for the application you need: | |
REM https://www.depicus.com/wake-on-lan/wake-on-lan-cmd | |
:_start | |
REM Start of script | |
@echo off | |
cls | |
title Wake-on-LAN Sklep v1 | |
color f0 | |
mode con:cols=70 lines=15 | |
goto _set_variables | |
:_set_variables | |
REM Set the computer name or IP, MAC with only HEX and without separators, subnet and port | |
REM One set per computers. Also add the machine later in the script | |
cls | |
set computer1_ip= | |
set computer1_mac= | |
set computer1_port= | |
set computer2_ip= | |
set computer2_mac= | |
set computer2_port= | |
set computer3_ip= | |
set computer3_mac= | |
set computer3_port= | |
set subnet_mask= | |
goto _set_folders | |
:_set_folders | |
REM Set the folders to be verified | |
cls | |
set _WolCmd-app=C:\Program Files\WolCmd\ | |
goto _WolCmd | |
:_WolCmd | |
REM Set the WolCmd.exe path as a variable | |
cls | |
cd "%_WolCmd-app%" | |
REM Check if WolCmd.exe is available | |
IF EXIST "%_WolCmd-app%\WolCmd.exe" (goto _wake_computers) else (goto _WolCmd_unavailable) | |
goto _WolCmd | |
:_WolCmd_unavailable | |
REM The error screen for WolCmd is missing | |
color 47 | |
cls | |
echo ---------------------------------------------------------------------- | |
echo. | |
echo. | |
echo. | |
echo. | |
echo. | |
echo WolCmd is unavailable. Please install | |
echo. | |
echo. | |
echo. | |
echo. | |
echo. | |
echo ---------------------------------- ---------------------------------- | |
pause | |
color f0 | |
goto EOF | |
:_wake_computers | |
REM Run the tasks | |
color f0 | |
cls | |
echo ---------------------------------------------------------------------- | |
echo. | |
echo. | |
echo Wake-On-Lan Computers | |
echo. | |
echo | |
echo. | |
echo | |
echo | |
echo | |
echo. | |
echo. | |
echo ---------------------------------- ---------------------------------- | |
goto _send_wol | |
:_send_wol | |
REM Send the signal | |
cd "%_WolCmd-app%" | |
REM Trying to wake computers | |
wolcmd %computer1_mac% %computer1_ip% %subnet_mask% %computer1_port% | |
timeout /T 3 | |
wolcmd %computer2_mac% %computer2_ip% %subnet_mask% %computer2_port% | |
timeout /T 3 | |
wolcmd %computer3_mac% %computer3_ip% %subnet_mask% %computer3_port% | |
timeout /T 3 | |
:EOF | |
REM Exit the batch | |
cls | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment