Skip to content

Instantly share code, notes, and snippets.

@jalbertbowden
Last active August 6, 2019 17:21
Show Gist options
  • Select an option

  • Save jalbertbowden/811445d0530aae7d4da22ef9f1bcdf61 to your computer and use it in GitHub Desktop.

Select an option

Save jalbertbowden/811445d0530aae7d4da22ef9f1bcdf61 to your computer and use it in GitHub Desktop.
Scripts for turning off Firefox and Edge on Windows after idle time.
@echo off
for /f "tokens=1 delims=" %%# in ('qprocess^|find /i /c /n "MicrosoftEdg"') do (
set count=%%#
)
taskkill /F /IM MicrosoftEdge.exe /T
taskkill /F /IM firefox.exe /T
pause
$prompt = new-object -comobject wscript.shell
$answer = $prompt.popup("Are you still using the Internet?`n",5,"Alert Modal",3)
if($answer -eq 6) {Write-Host "Yes was selected"}
if($answer -eq 7) {Write-Host "No was selected"}
if($answer -eq -1) {
start-process "C:\Users\Albert Bowden\Desktop\powershell-scripts\kill-browsers.bat" -WindowStyle Hidden
}
if($answer -eq 2) {Write-Host "Canceled by user."}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment