The Lost Art of Batch Programming
No matter what other interesting skills you acquire, an ability to write DOS batch files is a skill that you will cherish throughout your life. And should you survive to a hundred and five, batch programs may be the one thing that remains unchanged.
Piping, Pinging, setting the path, echoing.... all the good stuff...
Here's an example of using a batch program to stop an application (CALC.exe in this case) from being run twice on the one machine.
IF EXIST C:\%COMPUTERNAME%.txt GOTO RUNNING
ipconfig > C:\%COMPUTERNAME%.txt
ECHO PROGRAM STARTED...
ECHO PROGRAM FINISHED
IF EXIST C:\%COMPUTERNAME%.txt DEL C:\%COMPUTERNAME%.txt
ECHO FILE IS ALREADY RUNNING
This example used the following:
- ENVIRONMENT VARIABLES (%COMPUTERNAME%)
- REDIRECTION (>)
- LABELS (:)
My book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.