Here's something easy you can do with a batch file. Say you have a laptop you tote between work and home, and you have want to back up a file before you use it, but only when you're at the office. I say office, but any two computing environments might work. Use this trick to write a batch file that you use to launch the file...backing it up before launching it.
Use the batch IF command to create some behavior that only occurs in one of your environments.
IF keys off of the existence of a file or folder, so you need some distinction of that sort. But usually, you'll have access to some mapped drive letter in one environment that you won't have in the other.
So, write your commands like this
IF NOT EXIST X:\WORKFOLDER GOTO :NOTATWORK
xxx commands to be run when you're at work xxx
:NOTATWORK
http://imgs.xkcd.com/comics/goto.png
ReplyDelete