Skip to content

Instantly share code, notes, and snippets.

@AliMilani
Last active May 28, 2022 09:37
Show Gist options
  • Save AliMilani/261d2890ed72227d0f23ddfcbb6a9296 to your computer and use it in GitHub Desktop.
Save AliMilani/261d2890ed72227d0f23ddfcbb6a9296 to your computer and use it in GitHub Desktop.
@echo off
@REM Author: Ali Milani
@REM Description: wait for internet connection and then run the command
@REM GitHub gist: https://gist.github.com/AliMilani/261d2890ed72227d0f23ddfcbb6a9296
@REM minimize the window
if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
:loop
call :change_color
cls
echo No internet connection found.
timeout /t 1 /nobreak
Ping google.com -n 1 -w 1000
if errorlevel 1 (goto loop) else (goto connected)
cls
:connected
start chrome --profile-directory=Default https://github.com/alimilani
exit
:change_color
@REM random color
SET /A color_code=%RANDOM% * 9 / 32768 + 1
color %color_code%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment