Should do. No diode necessary, but a couple of 100nF capacitors would be good, from the centre leg of the regulator to each of the outer legs. What current is the 9V output expected to drive? That regulator can supply 2 amps, but only if it's kept coolish. Bear in mind that the supply is really at least 14V (assuming this is car based?), so at 2A the regulator will be dissipating (14-9)x2 = 10Watts, which would need heatsinking for sure. Why do you need 'straight through' sometimes, and 9V at others? I'm also assuming that your thread title is wrong, and you're not actually trying to generate 12v from 9V with this circuit, which really wouldn't work!
its in an xbox 360, im running the fans at 9v using a regulator instead of the stock 6v, but i want to fit a switch to the outside of the case to switch it up to 12v The fans draw 0.5A, why would i need the caps?
OK, if the 12V is really 12V, and the fans only draw 0.5A the regulator won't get nearly as hot, but you still might want to screw it to a little aluminium plate or something. The capacitors are possibly not essential, but help the regulator to run in a stable way. A couple of Maplin BX03D would be suitable, with lead lengths kept as short as possible.
Providing a short directly agross a linear regulator like that just isn't a very nice thing to do. I'm honestly unsure as to how the regulator would react until I tried it on the bench, but it could start sinking current into its output pin and dump it out of the ground terminal. You're better off using a SPDT switch (one that has a 'common' and then two further A and B terminals that the common switches between) to select between 12V and the 9V output from the regulator. Or, keep switch in position that you've shown, but have a diode between output terminal of the 78xx device and the switch.
yeah thats great, will go with the diode option as ive got the switches SPST and 9v regs already. Can you recommend a diode? ive only got 5.7v zener ones at the mo. Oh and thanks for the replys guys, much appreciated!
Actually now i think about it, I might be best of going down this route as mentioned by trev. Am i right in thinking i need a cap (C in the pic) at those points to provide a constant voltage, like a stabiliser, during the switch over? *EDIT* Ive changed the pic!