free-k
asked on
bat file self delete
I have a little problem.
I have a file that runs and updates sertain registry settings. it is just a little .bat file that runs and then calls the .reg file which gets added into the users registrty.
The bat file is only suppose to run once.
I want the .bat file to delete itself after it has run and I am able to do this if I run it from the command prompt. But if it runs from the startup folder or if I double click on it, it only updates the registry and does not delete itself.
the .bat file looks like this
@echo off
c:\update.reg
pause
del %0.bat
I have a file that runs and updates sertain registry settings. it is just a little .bat file that runs and then calls the .reg file which gets added into the users registrty.
The bat file is only suppose to run once.
I want the .bat file to delete itself after it has run and I am able to do this if I run it from the command prompt. But if it runs from the startup folder or if I double click on it, it only updates the registry and does not delete itself.
the .bat file looks like this
@echo off
c:\update.reg
pause
del %0.bat
Remove the pause statement.
Your script may also hang on the registry import.
Try this instead:
@echo off
regedit /s c:\update.reg
del %0.bat
Try this instead:
@echo off
regedit /s c:\update.reg
del %0.bat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey cwp
Thank you very much for the help and the advice. It works exactly the way I want it to now.
Regards,
Dan
Thank you very much for the help and the advice. It works exactly the way I want it to now.
Regards,
Dan