I have a large number of files, over 7000. I need to run GDAL commands on those files, but I am limited by 8191 characters in Windows. Is there any way to avoid this limitation?
first you create a vrt with all your files, then you use this vrt as input of your other tools.
Of course, building vrt will also be limited in number of characters, but :
you can use wildcard *, e.g
gdalbuildvrt output.vrt /path/to/input/example*.tif
you can use a text file with all the names of your input files in it (onefile per line), using
gdalbuildvrt output.vrt -input_file_list my_list.txt
It depends on what GDAL command you want to perform but using optfile as documented in http://www.gdal.org/gdal_utilities.html may come to your rescue.
Read the named file and substitute the contents into the command line options list. Lines beginning with # will be ignored. Multi-word arguments may be kept together with double quotes.