Be a Lazy Programmer -- Windows Script
As a lazy programmer, I want to automate our daily affairs as much as possible.
Task One:
Every morning, when I get to the office, I have to first start some programs, and exit these programs and hibernate my laptop when I get off work.
It is boring. So today I write two very simple scripts to automate these operation, to automate start and exit these processes.
StartWork.bat
@echo offecho Begin the day's work
start "" "C:\Program Files\Namoroka 3.6 Alpha 1\firefox.exe"
start "" C:\notes\notes.exe
tasklist /FI "IMAGENAME eq sametime.exe" | find /I /N "sametime.exe" >NUL
if "%ERRORLEVEL%" neq "0" (echo "sametime is not running";
start "" "C:\Program Files\IBM\Sametime Connect\sametime.exe") else (echo "sametime is already running")
OffWork.bat
@echo off
echo end of the day's work
taskkill /F /fi "ImageName eq notes.exe"
taskkill /F /fi "ImageName eq sametime75.exe"
rem command to shut down other programmes
taskkill /F /fi "ImageName eq firefox.exe"