title: How to retrieve value of pwd from powershell in c# code
body: <p>I was looking for the answer at least 3 hours, but without success.<br>
  Everywhere are just pieces of code and I have no idea how to connect them together.</p>
  <p>What I want to achieve:<br>
  I am creating dotnet-tool in which I need to process current working directory (value which is printed using <code>pwd</code> command in PS).
  Dotnet tool will be installed in default directory C:\Users\Samuel\.dotnet\.store\myTool... but command can be invoked in any directory in PS using <code>dotnet tool run myTool</code>.<br></p>
  <p>For example:<br>
  In PS I am in: C:\Users\Samuel\AxisRepos&gt; and I run <code>dotnet tool run myTool</code><br>
  In this case I want to retrieve C:\Users\Samuel\AxisRepos in C# code to find out, in which directory command was invoked.</p>
  <p>So simply put, I want to do something like this in my dotnet tool:</p>
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var pwd = GetPwdFromPowerShell();
      }
  
      static string GetPwdFromPowerShell()
      {
          string pwd = &quot;&quot;;
  
          // Retrieve current working directory from PS in which dotnet tool was invoked
  
          return pwd;
      }
  }
  </code></pre>