WinCE Autorun only once?

Hello ,
I’m making a Disk-on-key with Autorun folder with Update script with to update the registry

47#"\USB HD\UPDATE.EXE" /u \USB HD\FlashBackup.bin

I want it to reboot after it finishes the update so I use /r option in the end.

The problem that if I’m not removing the Disk-on-key from the board , It will start updating it again after the reboot ,

Q: Is there any option to make it run only once , even if I wont remove the usb stick ?

P.S I want to do it without deleting the file from autorun after it first run.

If you don´t want to delete any file, than you can create some file in first run of your script, and add the control of presence that file. See older version of Toradex Production programming script, where they created file named secondboot to detect second start of the module.

We solved this like that in a earlier Update Script, where we had similar issues:

IF EXIST secondBoot GOTO SecondBoot
IF NOT EXIST secondBoot GOTO FirstBoot

REM create a status file 
echo FirstBoot passed > secondBoot
REM Do some other action here
ECHO Going to reboot...
update.exe /rc

DEL secondBoot
REM Do second boot action here (i.e clean programming batch file if not needed any longer)

Thank you.

Well done , yea I was looking to implement something similar to this, but haven’t thought about this way.

Thank you!