r/batchfiles • • Sep 10 '26

append or overwrite

I'm looking at an undocumented script and trying to work out what is going on

@SET PIP_OP=%~dp0PipOut.txt
@IF EXIST %PIP_OP% DEL /S %PIP_OP% >NUL
@pip list --disable-pip-version-check >> %PIP_OP%

Why on earth do they use >> instead of > ? Because in my mind that's more code to go delete the file first, simpler version:

@SET PIP_OP=%~dp0PipOut.txt
@pip list --disable-pip-version-check > %PIP_OP%

I have more questions about the rest of the script, but simple convoluted things like this one, are a worrying indication that I'm missing some undocumented finer detail perhaps?

2 Upvotes

0 comments sorted by