Update
As mentioned in other answer this approach won't work. So the answer is no longer applied.
You can try resolving the output path and create a folder by doing the following:
<#@ import namespace="System.IO" #>
var efHost = (EfTextTemplateHost)Host;
var outputPath = Path.Combine(Path.GetDirectoryName(efHost.TemplateFile), "YourFolder");
if (!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
Now to output to different folder you can try using the GenerationEnvironment similar to this:
<#@ dte processor="T4Toolbox.DteProcessor" #>
<#@ TransformationContext processor="T4Toolbox.TransformationContextProcessor" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="EnvDTE" #>
<#@ import namespace="T4Toolbox" #>
ProcessOutputTemplate template = new ProcessOutputTemplate(this.GenerationEnvironment.ToString());
template.Output.File = outputPath;
template.Render();
this.GenerationEnvironment.Clear();
Note: this approach requires the T4 Toolbox installed in the VS 2012/13 - http://www.olegsych.com/t4toolbox/ (http://www.olegsych.com/t4toolbox/gettingstarted/)