Fix #7515: bazel_rules_test fails on Windows.
Fix #7515: bazel_rules_test fails on Windows.

The test had a couple of problems:
- A misunderstanding of how PATH looks like in MSYS on Windows - it's not delimited by ';', but by ':'. Drive letters are not a problem, because MSYS represents these as virtual directories (e.g. C:\TEST becomes /c/TEST). By using a ';', the first entry in the PATH became invalid, which lead to the Bazel wrapper no longer being found.
- "export env variables and then try to restore them later" instead of just calling exactly the program that should use them with the env vars explicitly set. This is problematic, because the env vars do not get restored in case of failure and also because it's overly broad.
- Rewriting the existing tool "env" using "echo" and a select() construct.
- Didn't redirect output of "bazel" into $TEST_log.

By setting PATH to a wrong value on Windows, this caused the "bazel" command in the test to accidentally run the "bazel" binary from the system instead of the runfiles, so the test didn't test the correct Bazel version. We only noticed this when we replaced the "bazel" binary on the CI machines with Bazelisk, which crashed, because $HOME (Linux, macOS) and %LocalAppDir% were not set and Bazelisk requires these.

RELNOTES: None.
PiperOrigin-RevId: 235490629

safarmer/bazel,cushon/bazel,katre/bazel,twitter-forks/bazel,bazelbuild/bazel,werkt/bazel,werkt/bazel,werkt/bazel,ulfjack/bazel,davidzchen/bazel,akira-baruah/bazel,dslomov/bazel-windows,cushon/bazel,safarmer/bazel,meteorcloudy/bazel,dslomov/bazel,perezd/bazel,dslomov/bazel,davidzchen/bazel,safarmer/bazel,dslomov/bazel,cushon/bazel,twitter-forks/bazel,safarmer/bazel,davidzchen/bazel,aehlig/bazel,dslomov/bazel-windows,werkt/bazel,ulfjack/bazel,katre/bazel,werkt/bazel,perezd/bazel,twitter-forks/bazel,dslomov/bazel-windows,ulfjack/bazel,ButterflyNetwork/bazel,akira-baruah/bazel,bazelbuild/bazel,katre/bazel,aehlig/bazel,meteorcloudy/bazel,katre/bazel,perezd/bazel,meteorcloudy/bazel,twitter-forks/bazel,aehlig/bazel,cushon/bazel,bazelbuild/bazel,akira-baruah/bazel,ButterflyNetwork/bazel,ulfjack/bazel,ulfjack/bazel,perezd/bazel,dslomov/bazel-windows,werkt/bazel,katre/bazel,ulfjack/bazel,katre/bazel,akira-baruah/bazel,ButterflyNetwork/bazel,twitter-forks/bazel,safarmer/bazel,perezd/bazel,aehlig/bazel,davidzchen/bazel,twitter-forks/bazel,dslomov/bazel-windows,aehlig/bazel,akira-baruah/bazel,dslomov/bazel,dslomov/bazel,meteorcloudy/bazel,ButterflyNetwork/bazel,davidzchen/bazel,meteorcloudy/bazel,perezd/bazel,twitter-forks/bazel,ulfjack/bazel,dslomov/bazel,bazelbuild/bazel,perezd/bazel,dslomov/bazel,meteorcloudy/bazel,meteorcloudy/bazel,aehlig/bazel,safarmer/bazel,davidzchen/bazel,akira-baruah/bazel,ButterflyNetwork/bazel,cushon/bazel,aehlig/bazel,bazelbuild/bazel,cushon/bazel,ButterflyNetwork/bazel,bazelbuild/bazel,davidzchen/bazel,dslomov/bazel-windows