Directly after a new Windows installation, I want to have my cloned git repository of batch files in the PATH persistently so that it gets searched after rebooting or opening a new console window.
At that moment, there is not much of a 1024 PATH character limitation, but be aware about that limit if you try this yourself.
This is my add-current-directory-to-path-at-end.persistent-and-limit-to-1024-characters.bat:
:: https://serverfault.com/questions/664180/can-i-permanently-add-to-path-in-windows-using-batch
:: https://superuser.com/questions/812754/how-to-recover-from-path-being-truncated-to-1024-characters-by-setx
:: global environment
setx PATH "%PATH%;%CD%"
:: local process
:: https://superuser.com/questions/975605/add-current-directory-to-path
set PATH=%PATH%;%CD%
I execute it from within the cloned git directory.
Oh: you need to double-quote the SETX parameters, otherwise you get an error message: “ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).“.
More links than the above ones from the batch file, especially on the 1024 character limitation:





