Shai Menzin
Shai Menzin

Reputation: 55

force deleting a file in through bat file

I have made a folder compiler for c using gcc and it creates useless files that I would like to delete when the program ends. I run the folder compiler through a bat file but it won't let me delete the files at the end. code:

compiler.exe
cls
runner.bat
del file.txt /F /Q

Upvotes: 0

Views: 1687

Answers (1)

Magoo
Magoo

Reputation: 80203

If you are saying that the delete isn't taking place, then the reason is that

runner.bat

transfers execution to the batch runner.bat and when that terminates, so does the process.

You need

call runner.bat

which will return at the end of runner.bat and continue with your main batch.

Upvotes: 3

Related Questions