Skip to content

Instantly share code, notes, and snippets.

@albertofwb
Created August 9, 2017 07:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertofwb/e9c561ed09897e2eebe88617dc6597c3 to your computer and use it in GitHub Desktop.
Save albertofwb/e9c561ed09897e2eebe88617dc6597c3 to your computer and use it in GitHub Desktop.
put this script in "C:\windows\system32" then you can simply type "restart AppName" to restart windows softwares
@echo off
set App=%1
set SleepSeconds=2
set PingIP=127.0.0.1
if "%App%" == "" (
goto usage
)
if "%App:~-3%" neq "exe" (
set App=%App%.exe
)
taskkill /f /im %App% >nul
if errorlevel 1 goto invalid
ping -n %SleepSeconds% %PingIP% >nul
start %App%
goto done
:usage
echo %0 AppName
goto done
:invalid
echo can't find %App%
goto done
:done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment