Per discussion here, if you have a v1.1 version of the Raspberry Pi 7″ touchscreen, you can vary the brightness by setting a value of 1 to 255 into the file /sys/class/backlight/rpi-backlight/brightness
Use sudo to echo values to a file, do:
sudo sh -c "echo 80 > /sys/class/backlight/rpi_backlight/brightness"