title: How to run .cmd files and commands
body: <p>I go to folder <code>C:\projects</code> and run script <code>init.cmd</code> that initializes environment, the I go to any project, e.g. <code>C:\projects\my_app</code> and run command <code>build</code> that builds the project. I need to automate it in PowerShell. How to that? My try:</p>
  
  <pre><code>Set-Location "C:\projects"
  Invoke-Item init.cmd   # c:\projects\init.cmd
  
  # Wait for init.cmd finish its work
  
  $paths = Get-Content $paths_array
  foreach ($path in $paths)
  {
     Set-Location $path
     Invoke-Item build   # build is set in paths
     # Wait for build finish its work
  }
  </code></pre>