title: Batch Script for Team Foundation Server's Get method throws error when called via a program
body: <p>I use a batch script to automatically get and compile several solutions. Here is a sample snippet from the batch file:</p>
  
  <pre><code>"C:\...\IDE\TF.exe" get $/NG3rdParty/Main /recursive
  </code></pre>
  
  <p>This works fine when I call it from command prompt. However, I am writing a C# program to change the version numbers of DLLs, it does the following:</p>
  
  <pre><code>var businessFile= @"C:\Build\Common.AssemblyInfo.cs";
  
  var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(@"http://tfs:8080"));
  var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(businessFile);
  var workspace = workspaceInfo.GetWorkspace(tfs);
  workspace.PendEdit(businessFile);
  var batchFilePath = @"\CleanBuild.bat";
  var batchFile = path + batchFilePath;
  
  
  var p = new Process
      {
          StartInfo =
              {
                  FileName = batchFile, 
                  UseShellExecute = true
              }
      };
  p.Start();
  p.WaitForExit();
  </code></pre>
  
  <p>When the batch file is called from program, the same line throws this exception:</p>
  
  <p><code>Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.</code></p>