Solved Script for first time only.

March 14, 2012 at 01:58:59
Specs: Windows XP, 2 gigs.
I designed a batch file but i need to make sure one of the scripts only happens the first time it is run.

See More: Script for first time only.

Report •

March 14, 2012 at 20:47:20
✔ Best Answer
Create a file the first time you run the script, and the next time you can bypass the script if the file already exists:

if exist alreadyrun.txt  GOTO skipscript
if not exist alreadyrun.txt  type nul > alreadyrun.txt

You could also use an environment variable if it is OK to rerun the script after a reboot.

Report •
Related Solutions

Ask Question