Batch Scripting
I still use batch scripting for automating a lot of tasks in Windows. Batch is a very simple language and has its limitations but its simplicity and ubiquity in windows makes it ideal for a number of things. This page contains links and information related to writing batch scripts.
If you are after more complete scripting solutions for windows, I suggested looking into VBScript, JavaScript or Powershell.
Starting and stopping processes
The following batch script will start a program in a given directory in minimized window mode:
@echo off
echo.
echo Starting [ProgramName]
echo.
start /D"C:\Program Files\[ProgramDir]\" /MIN /B [ProgramExec].exe
- Replace [ProgramName] with a description of the program that you are starting. This is for informational purposes only.
- Replace [ProgramDir] with the directory your program is installed.
- Replace [ProgramExec.exe] with the executable program.
The following batch script will stop a particular program executable by killing the process (this is done forcefully).
@echo off
echo.
echo Stopping [ProgramName]
echo.
taskkill /F /IM [ProgramExec].exe
- Replace [ProgramName] with a description of the program that you are starting. This is for informational purposes only.
- Replace [ProgramExec] with the executable program that you want to stop.
The key to these two batch scripts is:
- Using the start command to start the program. Type start /? in a command prompt to learn more.
- Using the taskkill command to stop the program. Type taskkill /? in a command prompt to learn more.
